class KPrintDialogPage


Table of contents
Modules
kdeprint Classes
All Classes
Module kdeprint
Namespace global
Class KPrintDialogPage
Inherits QWidget

This class is intended to be used as base class for customized print dialog page. One of the feature of the KDE print framework is to allow to customize the print dialog to add some application specific print options. This is done by subclassing KPrintDialogPage and reimplementing the 3 virtual functions getOptions, setOptions and isValid(). The print options will be stored in the KPrinter object, and will be accessible via KPrinter.option(). The option name should follow the form "kde-appname-optionname" for internal reasons.

#include 

class MyDialogPage : public KPrintDialogPage { public: MyDialogPage( QWidget *parent = 0, const char *name = 0 );

//reimplement virtual functions void getOptions( QMap& opts, bool incldef = false ); void setOptions( const QMap& opts ); bool isValid( QString& msg );

private: QComboBox *m_fontcombo; }

MyDialogPage.MyDialogPage( QWidget *parent, const char *name ) : KPrintDialogPage( parent, name ) { setTitle( i18n( "My Page" ) ); }

void MyDialogPage.getOptions( QMap& opts, bool incldef ) { if ( incldef || m_fontcombo->currentText() != mydefaultvalue ) opts[ "kde-myapp-fontname" ] = m_fontcombo->currentText(); }

void MyDialogPage.setOptions( const QMap& opts ) { QString fntname = opts[ "kde-myapp-fontname" ]; m_fontcombo->setEditText( fntname ); }

bool MyDialogPage.isValid( QString& msg) { if ( m_fontcombo->currentText().isEmpty() ) { msg = i18n( "Font name cannot be empty." ); return false; } return true; }

Base class for customized print dialog pages.

See also KPrinter



methods