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

# QAbstractPrintDialog Class Reference
[QtGui module]

The QAbstractPrintDialog class provides a base implementation for print dialogs used to configure printers. More...

     #include <QAbstractPrintDialog>

Inherits QDialog.

Inherited by QPrintDialog.

- List of all members, including inherited members

### Public Types

- enum PrintDialogOption { None, PrintToFile, PrintSelection, PrintPageRange, ..., PrintShowPageSize }
- flags PrintDialogOptions
- enum PrintRange { AllPages, Selection, PageRange }

### Public Functions

- QAbstractPrintDialog ( QPrinter * printer, QWidget * parent = 0 )
- void addEnabledOption ( PrintDialogOption option )
- PrintDialogOptions enabledOptions () const
- virtual int exec () = 0
- int fromPage () const
- bool isOptionEnabled ( PrintDialogOption option ) const
- int maxPage () const
- int minPage () const
- PrintRange printRange () const
- QPrinter * printer () const
- void setEnabledOptions ( PrintDialogOptions options )
- void setFromTo ( int from, int to )
- void setMinMax ( int min, int max )
- void setOptionTabs ( const QList<QWidget *> & tabs )
- void setPrintRange ( PrintRange range )
- int toPage () const

- 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 QAbstractPrintDialog class provides a base implementation for print dialogs used to configure printers.

This class implements getter and setter functions that are used to customize settings shown in print dialogs, but it is not used directly. Use QPrintDialog to display a print dialog in your application.

See also QPrintDialog, QPrinter, and Printing with Qt.

## Member Type Documentation

### enum QAbstractPrintDialog::PrintDialogOption
flags QAbstractPrintDialog::PrintDialogOptions

Used to specify which parts of the print dialog should be visible.

Constant | Value | Description
--- | --- | ---
`QAbstractPrintDialog::None` | `0x0000` | None of the options are enabled.
`QAbstractPrintDialog::PrintToFile` | `0x0001` | The print to file option is enabled.
`QAbstractPrintDialog::PrintSelection` | `0x0002` | The print selection option is enalbed.
`QAbstractPrintDialog::PrintPageRange` | `0x0004` | The page range selection option is enabled.
`QAbstractPrintDialog::PrintCollateCopies` | `0x0010` |

`QAbstractPrintDialog::DontUseSheet`

`0x0020`

Do not make the native print dialog a sheet. By default on Mac OS X, the native dialog is made a sheet if it has a parent that can accept sheets and is visible. Internally, Mac OS X tracks whether a printing session and not which particular dialog should be a sheet or not. Therefore, make sure this value matches between the page setup dialog and the print dialog or you can potentially end up in a modal loop that you can't break.

`QAbstractPrintDialog::PrintShowPageSize` | `0x0008` | Show the page size + margings page only if this is enabled.

The PrintDialogOptions type is a typedef for QFlags<PrintDialogOption>. It stores an OR combination of PrintDialogOption values.

### enum QAbstractPrintDialog::PrintRange

Used to specify the print range selection option.

Constant | Value | Description
--- | --- | ---
`QAbstractPrintDialog::AllPages` | `0` | All pages should be printed.
`QAbstractPrintDialog::Selection` | `1` | Only the selection should be printed.
`QAbstractPrintDialog::PageRange` | `2` | The specified page range should be printed.

See also QPrinter::PrintRange.

## Member Function Documentation

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

Constructs an abstract print dialog for printer with parent as parent widget.

### void QAbstractPrintDialog::addEnabledOption ( PrintDialogOption option )

Adds the option option to the set of enabled options in this dialog.

Except for the DontUseSheet option, this function has no effect on Mac OS X. See the QPrintDialog documentation for more information.

### PrintDialogOptions QAbstractPrintDialog::enabledOptions () const

Returns the set of enabled options in this dialog.

See also setEnabledOptions().

### int QAbstractPrintDialog::exec () `[pure virtual]`

This virtual function is called to pop up the dialog. It must be reimplemented in subclasses.

### int QAbstractPrintDialog::fromPage () const

Returns the first page to be printed By default, this value is set to 0.

### bool QAbstractPrintDialog::isOptionEnabled ( PrintDialogOption option ) const

Returns true if the specified option is enabled; otherwise returns false

### int QAbstractPrintDialog::maxPage () const

Returns the maximum page in the page range. As of Qt 4.4, this function returns INT_MAX by default. Previous versions returned 1 by default.

### int QAbstractPrintDialog::minPage () const

Returns the minimum page in the page range. By default, this value is set to 1.

### PrintRange QAbstractPrintDialog::printRange () const

Returns the print range.

See also setPrintRange().

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

Returns the printer that this printer dialog operates on.

### void QAbstractPrintDialog::setEnabledOptions ( PrintDialogOptions options )

Sets the set of options that should be enabled in the print dialog to options.

Except for the DontUseSheet option, this function has no effect on Mac OS X. See the QPrintDialog documentation for more information.

See also enabledOptions().

### void QAbstractPrintDialog::setFromTo ( int from, int to )

Sets the range in the print dialog to be from from to to.

### void QAbstractPrintDialog::setMinMax ( int min, int max )

Sets the page range in this dialog to be from min to max. This also enables the PrintPageRange option.

### void QAbstractPrintDialog::setOptionTabs ( const QList<QWidget *> & tabs )

Set a list of widgets as tabs to be shown on the print dialog, if supported.

Currently this option is only supported on X11.

Setting the option tabs will transfer their ownership to the print dialog.

This function was introduced in Qt 4.4.

### void QAbstractPrintDialog::setPrintRange ( PrintRange range )

Sets the print range option in to be range.

See also printRange().

### int QAbstractPrintDialog::toPage () const

Returns the last page to be printed. By default, this value is set to 0.