About using of QPrint and QPrintDialog
jimgilmour1
(Talk | contribs) m (minor edit) |
somnathbanik
(Talk | contribs) |
||
| Line 5: | Line 5: | ||
|devices= Emulator / desktop / device | |devices= Emulator / desktop / device | ||
|category=Qt | |category=Qt | ||
| − | |subcategory= | + | |subcategory= QPaintDevice |
|creationdate=28 November 2010 | |creationdate=28 November 2010 | ||
|keywords=QPrint, QPrintDialog | |keywords=QPrint, QPrintDialog | ||
}} | }} | ||
| − | |||
| − | + | == Overview == | |
| + | The {{Icode|QPrinter}} class is responsible for printing in Qt. Like {{Icode|QPixmap}} or {{Icode|QImage}}, it is a {{Icode|QPaintDevice}}. There is also the {{Icode|QPrintDialog}} class, enabling a variety of settings to be made at the printer. Under Windows and Mac OS X the class shows the print dialog of the system; otherwise, it uses a separate dialog. The user can manipulate all the settings in the dialog. But user must keep in mind some basic information while using these classes in the code. | ||
| − | <code> | + | |
| + | == Tips == | ||
| + | |||
| + | It is better to predefine {{Icode|QPrinter}} and {{Icode|QPrintDialog}} before using them inside the code or else compilation process will not be successful because of no printer support. | ||
| + | <code cpp> | ||
#ifndef QT_NO_PRINTER | #ifndef QT_NO_PRINTER | ||
| Line 28: | Line 32: | ||
</code> | </code> | ||
| − | |||
| − | |||
Revision as of 17:13, 28 April 2011
Article Metadata
Tested with
Devices(s): Emulator / desktop / device
Compatibility
Platform(s): All Qt Supported
Article
Keywords: QPrint, QPrintDialog
Created: (28 Nov 2010)
Last edited: somnathbanik
(28 Apr 2011)
Overview
The QPrinter class is responsible for printing in Qt. Like QPixmap or QImage, it is a QPaintDevice. There is also the QPrintDialog class, enabling a variety of settings to be made at the printer. Under Windows and Mac OS X the class shows the print dialog of the system; otherwise, it uses a separate dialog. The user can manipulate all the settings in the dialog. But user must keep in mind some basic information while using these classes in the code.
Tips
It is better to predefine QPrinter and QPrintDialog before using them inside the code or else compilation process will not be successful because of no printer support.
#ifndef QT_NO_PRINTER
...
QPrinter printer(QPrinter::HighResolution);
QPrintDialog dialog(&printer, this);
...
#endif

