Home · All Namespaces · All Classes · Grouped Classes · Modules · Functions |
The QtopiaPrinterPlugin class provides an abstract base for QtopiaPrinterInterface plug-ins. More...
#include <QtopiaPrinterPlugin>
Inherits QObject and QtopiaPrinterInterface.
The QtopiaPrinterPlugin class provides an abstract base for QtopiaPrinterInterface plug-ins.
To create a new printer plug-in, create a new project directory, for example, newprinter, under $QPEDIR/src/plugins/qtopiapringing/.
Create a new printing mechanism by sub-classing QtopiaPrinterPlugin and reimplementing the pure virtual functions. The new plug-in must be exported. For example:
class QTOPIA_PLUGIN_EXPORT NewPrinterPlugin : public QtopiaPrinterPlugin { Q_OBJECT public: NewPrinterPlugin( QObject *parent = 0 ); ~NewPrinterPlugin(); virtual void print( QMap<QString, QVariant> options ); ... };
Use QPluginManager to load plug-ins from an application. For example:
QPluginManager *manager = new QPluginManager( "qtopiaprinting" ); QObject *instance; QtopiaPrinterInterface *iface; instance = manager->instance( "newprinter" ); iface = qobject_cast<QtopiaPrinterPlugin *>(instance); if ( iface ) { if ( iface->isAvailable() ) iface->printFile( fileName ); }
Alternatively, PrintService can be used.
QtopiaServiceRequest service( "Print", "print(QString)" ); service << fileName; service.send();
There is a Qt Extended Print Server that handles this request. The Print Server will present the user with a list of available plug-ins to choose from. It also loads the selected plug-in and dispatches the print job.
See also QtopiaPrinterInterface, QPluginManager, and PrintService.
Constructs a printer plug-in with the given parent.
Destroys the printer plug-in.
Copyright © 2009 Nokia | Trademarks | Qt Extended 4.4.3 |