Home · All Namespaces · All Classes · Main Classes · Grouped Classes · Modules · Functions |
The QPrintDialog class provides a dialog for specifying the printer's configuration. More...
#include <QPrintDialog>
Inherits QAbstractPrintDialog.
The QPrintDialog class provides a dialog for specifying the printer's configuration.
The dialog allows users to change document-related settings, such as the paper size and orientation, type of print (color or grayscale), range of pages, and number of copies to print.
Controls are also provided to enable users to choose from the printers available, including any configured network printers.
Typically, QPrintDialog objects are constructed with a QPrinter object, and executed using the exec() function.
QPrintDialog printDialog(printer, parent);
if (printDialog.exec() == QDialog::Accepted) {
// print ...
}
If the dialog is accepted by the user, the QPrinter object is correctly configured for printing.
The printer dialog (shown above in Plastique style) enables access to common printing properties. On X11 platforms that use the CUPS printing system, the settings for each available printer can be modified via the dialog's Properties push button.
On Windows and Mac OS X, the native print dialog is used, which means that some QWidget and QDialog properties set on the dialog won't be respected. The native print dialog on Mac OS X does not support setting printer options, i.e. QAbstractPrintDialog::setEnabledOptions() and QAbstractPrintDialog::addEnabledOption() have no effect.
In Qt 4.4, it was possible to use the satic functions to show a sheet on Mac OS X. This is no longer supported in Qt 4.5. If you want this functionality, use QPrintDialog::open().
See also QPageSetupDialog, QPrinter, Pixelator Example, Order Form Example, Image Viewer Example, and Scribble Example.
This property holds the various options that affect the look and feel of the dialog.
By default, all options are disabled.
Options should be set before showing the dialog. Setting them while the dialog is visible is not guaranteed to have an immediate effect on the dialog (depending on the option and on the platform).
This property was introduced in Qt 4.5.
Access functions:
See also setOption() and testOption().
Constructs a new modal printer dialog for the given printer with the given parent.
Constructs a print dialog with the given parent.
Destroys the print dialog.
This signal is emitted when the user accepts the values set in the print dialog. The printer parameter includes the printer that the settings were applied to.
Adds the button to the layout of the print dialog. The added buttons are arranged from the left to the right below the last groupbox of the printdialog.
This function is available for Unix platforms only.
Closes the dialog and sets its result code to result. If this dialog is shown with exec(), done() causes the local event loop to finish, and exec() to return result.
Reimplemented from QDialog.
See also QDialog::done().
This is an overloaded member function, provided for convenience.
Opens the dialog and connects its accepted() signal to the slot specified by receiver and member.
The signal will be disconnected from the slot when the dialog is closed.
This function was introduced in Qt 4.5.
Returns a pointer to the printer this dialog configures, or 0 if this dialog does not operate on any printer.
This function is available for Unix platforms only.
See also setPrinter().
Returns the printer that this printer dialog operates on. This can be useful when using the QPrintDialog::open() method.
Sets the given option to be enabled if on is true; otherwise, clears the given option.
See also options and testOption().
Sets this dialog to configure printer printer, or no printer if printer is null. If pickupSettings is true, the dialog reads most of its settings from printer. If pickupSettings is false (the default) the dialog keeps its old settings.
This function is available for Unix platforms only.
See also printer().
Returns true if the given option is enabled; otherwise, returns false.
See also options and setOption().
Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies) | Trademarks | Qt 4.5.1 |