|  | Home · All Namespaces · All Classes · Main Classes · Grouped Classes · Modules · Functions |

# QPrintDialog Class Reference
[QtGui module]

The QPrintDialog class provides a dialog for specifying the printer's configuration. More...

     #include <QPrintDialog>

Inherits QAbstractPrintDialog.

- List of all members, including inherited members

### Public Functions

- QPrintDialog ( QPrinter * printer, QWidget * parent = 0 )
- ~QPrintDialog ()
- void addButton ( QPushButton * button )
- QPrinter * printer () const
- void setPrinter ( QPrinter * printer, bool pickupSettings = false )

- 15 public functions inherited from QAbstractPrintDialog
- 5 public functions inherited from QDialog
- 206 public functions inherited from QWidget
- 29 public functions inherited from QObject
- 12 public functions inherited from QPaintDevice

### Additional Inherited Members

- 2 properties inherited from QDialog
- 57 properties inherited from QWidget
- 1 property inherited from QObject
- 4 public slots inherited from QDialog
- 19 public slots inherited from QWidget
- 1 public slot inherited from QObject
- 3 signals inherited from QDialog
- 1 signal inherited from QWidget
- 1 signal inherited from QObject
- 4 static public members inherited from QWidget
- 5 static public members inherited from QObject
- 1 static public member inherited from QPaintDevice
- 38 protected functions inherited from QWidget
- 7 protected functions inherited from QObject
- 1 protected function inherited from QPaintDevice
- 1 protected slot inherited from QWidget

## Detailed Description

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. In addition, aside from the DontUseSheet option, the native print dialog on Mac OS X does not support setting printer options, i.e. QAbstractPrintDialog::setEnabledOptions() and QAbstractPrintDialog::addEnabledOption() have no effect.

See also QPageSetupDialog, QPrinter, Pixelator Example, Order Form Example, Image Viewer Example, and Scribble Example.

## Member Function Documentation

### QPrintDialog::QPrintDialog ( QPrinter * printer, QWidget * parent = 0 )

Constructs a new modal printer dialog for the given printer with the given parent.

### QPrintDialog::~QPrintDialog ()

Destroys the print dialog.

### void QPrintDialog::addButton ( QPushButton * button )

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.

### QPrinter * QPrintDialog::printer () const

Returns a pointer to the printer this dialog configures, or 0 if this dialog does not operate on any printer.

See also setPrinter().

### void QPrintDialog::setPrinter ( QPrinter * printer, bool pickupSettings = false )

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.

See also printer().