Qt 5.6 | Qt GUI | C++ Classes | QPagedPaintDevice

Qt 5.6.2 Reference Documentation

# QPagedPaintDevice Class

The QPagedPaintDevice class is a represents a paintdevice that supports multiple pages. More...

Header: | #include <QPagedPaintDevice>
qmake: | QT += gui
Inherits: | QPaintDevice
Inherited By: | QPdfWriter

- List of all members, including inherited members

## Public Types

class | Margins
enum | PageSize { A0, A1, A2, A3, ..., LastPageSize }

## Public Functions

| QPagedPaintDevice()
| ~QPagedPaintDevice()
Margins | margins() const
virtual bool | newPage() = 0
QPageLayout | pageLayout() const
PageSize | pageSize() const
QSizeF | pageSizeMM() const
virtual void | setMargins(const Margins &margins)
bool | setPageLayout(const QPageLayout &newPageLayout)
bool | setPageMargins(const QMarginsF &margins)
bool | setPageMargins(const QMarginsF &margins, QPageLayout::Unit units)
bool | setPageOrientation(QPageLayout::Orientation orientation)
bool | setPageSize(const QPageSize &pageSize)
virtual void | setPageSize(PageSize size)
virtual void | setPageSizeMM(const QSizeF &size)

- 14 public functions inherited from QPaintDevice

### Additional Inherited Members

- 1 protected function inherited from QPaintDevice

## Detailed Description

The QPagedPaintDevice class is a represents a paintdevice that supports multiple pages.

Paged paint devices are used to generate output for printing or for formats like PDF. QPdfWriter and QPrinter inherit from it.

## Member Type Documentation

### enum QPagedPaintDevice::PageSize

This enum type lists the available page sizes as defined in the Postscript PPD standard. These values are duplicated in QPageSize and QPrinter.

The defined sizes are:

Constant | Value | Description
--- | --- | ---
`QPagedPaintDevice::A0` | `5` | 841 x 1189 mm
`QPagedPaintDevice::A1` | `6` | 594 x 841 mm
`QPagedPaintDevice::A2` | `7` | 420 x 594 mm
`QPagedPaintDevice::A3` | `8` | 297 x 420 mm
`QPagedPaintDevice::A4` | `0` | 210 x 297 mm, 8.26 x 11.69 inches
`QPagedPaintDevice::A5` | `9` | 148 x 210 mm
`QPagedPaintDevice::A6` | `10` | 105 x 148 mm
`QPagedPaintDevice::A7` | `11` | 74 x 105 mm
`QPagedPaintDevice::A8` | `12` | 52 x 74 mm
`QPagedPaintDevice::A9` | `13` | 37 x 52 mm
`QPagedPaintDevice::B0` | `14` | 1000 x 1414 mm
`QPagedPaintDevice::B1` | `15` | 707 x 1000 mm
`QPagedPaintDevice::B2` | `17` | 500 x 707 mm
`QPagedPaintDevice::B3` | `18` | 353 x 500 mm
`QPagedPaintDevice::B4` | `19` | 250 x 353 mm
`QPagedPaintDevice::B5` | `1` | 176 x 250 mm, 6.93 x 9.84 inches
`QPagedPaintDevice::B6` | `20` | 125 x 176 mm
`QPagedPaintDevice::B7` | `21` | 88 x 125 mm
`QPagedPaintDevice::B8` | `22` | 62 x 88 mm
`QPagedPaintDevice::B9` | `23` | 33 x 62 mm
`QPagedPaintDevice::B10` | `16` | 31 x 44 mm
`QPagedPaintDevice::C5E` | `24` | 163 x 229 mm
`QPagedPaintDevice::Comm10E` | `25` | 105 x 241 mm, U.S. Common 10 Envelope
`QPagedPaintDevice::DLE` | `26` | 110 x 220 mm
`QPagedPaintDevice::Executive` | `4` | 7.5 x 10 inches, 190.5 x 254 mm
`QPagedPaintDevice::Folio` | `27` | 210 x 330 mm
`QPagedPaintDevice::Ledger` | `28` | 431.8 x 279.4 mm
`QPagedPaintDevice::Legal` | `3` | 8.5 x 14 inches, 215.9 x 355.6 mm
`QPagedPaintDevice::Letter` | `2` | 8.5 x 11 inches, 215.9 x 279.4 mm
`QPagedPaintDevice::Tabloid` | `29` | 279.4 x 431.8 mm
`QPagedPaintDevice::Custom` | `30` | Unknown, or a user defined size.
`QPagedPaintDevice::A10` | `31` |
`QPagedPaintDevice::A3Extra` | `32` |
`QPagedPaintDevice::A4Extra` | `33` |
`QPagedPaintDevice::A4Plus` | `34` |
`QPagedPaintDevice::A4Small` | `35` |
`QPagedPaintDevice::A5Extra` | `36` |
`QPagedPaintDevice::B5Extra` | `37` |
`QPagedPaintDevice::JisB0` | `38` |
`QPagedPaintDevice::JisB1` | `39` |
`QPagedPaintDevice::JisB2` | `40` |
`QPagedPaintDevice::JisB3` | `41` |
`QPagedPaintDevice::JisB4` | `42` |
`QPagedPaintDevice::JisB5` | `43` |
`QPagedPaintDevice::JisB6` | `44` | ,
`QPagedPaintDevice::JisB7` | `45` |
`QPagedPaintDevice::JisB8` | `46` |
`QPagedPaintDevice::JisB9` | `47` |
`QPagedPaintDevice::JisB10` | `48` |
`QPagedPaintDevice::AnsiA` | `Letter` | = Letter
`QPagedPaintDevice::AnsiB` | `Ledger` | = Ledger
`QPagedPaintDevice::AnsiC` | `49` |
`QPagedPaintDevice::AnsiD` | `50` |
`QPagedPaintDevice::AnsiE` | `51` |
`QPagedPaintDevice::LegalExtra` | `52` |
`QPagedPaintDevice::LetterExtra` | `53` |
`QPagedPaintDevice::LetterPlus` | `54` |
`QPagedPaintDevice::LetterSmall` | `55` |
`QPagedPaintDevice::TabloidExtra` | `56` |
`QPagedPaintDevice::ArchA` | `57` |
`QPagedPaintDevice::ArchB` | `58` |
`QPagedPaintDevice::ArchC` | `59` |
`QPagedPaintDevice::ArchD` | `60` |
`QPagedPaintDevice::ArchE` | `61` |
`QPagedPaintDevice::Imperial7x9` | `62` |
`QPagedPaintDevice::Imperial8x10` | `63` |
`QPagedPaintDevice::Imperial9x11` | `64` |
`QPagedPaintDevice::Imperial9x12` | `65` |
`QPagedPaintDevice::Imperial10x11` | `66` |
`QPagedPaintDevice::Imperial10x13` | `67` |
`QPagedPaintDevice::Imperial10x14` | `68` |
`QPagedPaintDevice::Imperial12x11` | `69` |
`QPagedPaintDevice::Imperial15x11` | `70` |
`QPagedPaintDevice::ExecutiveStandard` | `71` |
`QPagedPaintDevice::Note` | `72` |
`QPagedPaintDevice::Quarto` | `73` |
`QPagedPaintDevice::Statement` | `74` |
`QPagedPaintDevice::SuperA` | `75` |
`QPagedPaintDevice::SuperB` | `76` |
`QPagedPaintDevice::Postcard` | `77` |
`QPagedPaintDevice::DoublePostcard` | `78` |
`QPagedPaintDevice::Prc16K` | `79` |
`QPagedPaintDevice::Prc32K` | `80` |
`QPagedPaintDevice::Prc32KBig` | `81` |
`QPagedPaintDevice::FanFoldUS` | `82` |
`QPagedPaintDevice::FanFoldGerman` | `83` |
`QPagedPaintDevice::FanFoldGermanLegal` | `84` |
`QPagedPaintDevice::EnvelopeB4` | `85` |
`QPagedPaintDevice::EnvelopeB5` | `86` |
`QPagedPaintDevice::EnvelopeB6` | `87` |
`QPagedPaintDevice::EnvelopeC0` | `88` |
`QPagedPaintDevice::EnvelopeC1` | `89` |
`QPagedPaintDevice::EnvelopeC2` | `90` |
`QPagedPaintDevice::EnvelopeC3` | `91` |
`QPagedPaintDevice::EnvelopeC4` | `92` |
`QPagedPaintDevice::EnvelopeC5` | `C5E` | = C5E
`QPagedPaintDevice::EnvelopeC6` | `93` |
`QPagedPaintDevice::EnvelopeC65` | `94` |
`QPagedPaintDevice::EnvelopeC7` | `95` |
`QPagedPaintDevice::EnvelopeDL` | `DLE` | = DLE
`QPagedPaintDevice::Envelope9` | `96` |
`QPagedPaintDevice::Envelope10` | `Comm10E` | = Comm10E
`QPagedPaintDevice::Envelope11` | `97` |
`QPagedPaintDevice::Envelope12` | `98` |
`QPagedPaintDevice::Envelope14` | `99` |
`QPagedPaintDevice::EnvelopeMonarch` | `100` |
`QPagedPaintDevice::EnvelopePersonal` | `101` |
`QPagedPaintDevice::EnvelopeChou3` | `102` |
`QPagedPaintDevice::EnvelopeChou4` | `103` |
`QPagedPaintDevice::EnvelopeInvite` | `104` |
`QPagedPaintDevice::EnvelopeItalian` | `105` |
`QPagedPaintDevice::EnvelopeKaku2` | `106` |
`QPagedPaintDevice::EnvelopeKaku3` | `107` |
`QPagedPaintDevice::EnvelopePrc1` | `108` |
`QPagedPaintDevice::EnvelopePrc2` | `109` |
`QPagedPaintDevice::EnvelopePrc3` | `110` |
`QPagedPaintDevice::EnvelopePrc4` | `111` |
`QPagedPaintDevice::EnvelopePrc5` | `112` |
`QPagedPaintDevice::EnvelopePrc6` | `113` |
`QPagedPaintDevice::EnvelopePrc7` | `114` |
`QPagedPaintDevice::EnvelopePrc8` | `115` |
`QPagedPaintDevice::EnvelopePrc9` | `116` |
`QPagedPaintDevice::EnvelopePrc10` | `117` |
`QPagedPaintDevice::EnvelopeYou4` | `118` |
`QPagedPaintDevice::LastPageSize` | `EnvelopeYou4` | = EnvelopeYou4

Due to historic reasons QPageSize::Executive is not the same as the standard Postscript and Windows Executive size, use QPageSize::ExecutiveStandard instead.

The Postscript standard size QPageSize::Folio is different to the Windows DMPAPER_FOLIO size, use the Postscript standard size QPageSize::FanFoldGermanLegal if needed.

## Member Function Documentation

### QPagedPaintDevice::QPagedPaintDevice()

Constructs a new paged paint device.

### QPagedPaintDevice::~QPagedPaintDevice()

Destroys the object.

### Margins QPagedPaintDevice::margins() const

Returns the current margins of the paint device. The default is 0.

Margins are specified in millimeters.

See also setMargins().

### `[pure virtual]` bool QPagedPaintDevice::newPage()

Starts a new page. Returns `true` on success.

### QPageLayout QPagedPaintDevice::pageLayout() const

Returns the current page layout. Use this method to access the current QPageSize, QPageLayout::Orientation, QMarginsF, fullRect() and paintRect().

Note that you cannot use the setters on the returned object, you must either call the individual QPagedPaintDevice setters or use setPageLayout().

This function was introduced in Qt 5.3.

See also setPageLayout(), setPageSize(), setPageOrientation(), and setPageMargins().

### PageSize QPagedPaintDevice::pageSize() const

Returns the currently used page size.

See also setPageSize().

### QSizeF QPagedPaintDevice::pageSizeMM() const

Returns the page size in millimeters.

See also setPageSizeMM().

### `[virtual]` void QPagedPaintDevice::setMargins(const Margins &margins)

Sets the margins to be used to margins.

Margins are specified in millimeters.

The margins are purely a hint to the drawing method. They don't affect the coordinate system or clipping.

See also margins().

### bool QPagedPaintDevice::setPageLayout(const QPageLayout &newPageLayout)

Sets the page layout to newPageLayout.

You should call this before calling QPainter::begin(), or immediately before calling newPage() to apply the new page layout to a new page. You should not call any painting methods between a call to setPageLayout() and newPage() as the wrong paint metrics may be used.

Returns true if the page layout was successfully set to newPageLayout.

This function was introduced in Qt 5.3.

See also pageLayout().

### bool QPagedPaintDevice::setPageMargins(const QMarginsF &margins)

Set the page margins in the current page layout units.

You should call this before calling QPainter::begin(), or immediately before calling newPage() to apply the new margins to a new page. You should not call any painting methods between a call to setPageMargins() and newPage() as the wrong paint metrics may be used.

To get the current page margins use pageLayout().pageMargins().

Returns true if the page margins were successfully set to margins.

This function was introduced in Qt 5.3.

See also pageLayout().

### bool QPagedPaintDevice::setPageMargins(const QMarginsF &margins, QPageLayout::Unit units)

Set the page margins defined in the given units.

You should call this before calling QPainter::begin(), or immediately before calling newPage() to apply the new margins to a new page. You should not call any painting methods between a call to setPageMargins() and newPage() as the wrong paint metrics may be used.

To get the current page margins use pageLayout().pageMargins().

Returns true if the page margins were successfully set to margins.

This function was introduced in Qt 5.3.

See also pageLayout().

### bool QPagedPaintDevice::setPageOrientation(QPageLayout::Orientation orientation)

Sets the page orientation.

The page orientation is used to define the orientation of the page size when obtaining the page rect.

You should call this before calling QPainter::begin(), or immediately before calling newPage() to apply the new orientation to a new page. You should not call any painting methods between a call to setPageOrientation() and newPage() as the wrong paint metrics may be used.

To get the current QPageLayout::Orientation use pageLayout().pageOrientation().

Returns true if the page orientation was successfully set to orientation.

This function was introduced in Qt 5.3.

See also pageLayout().

### bool QPagedPaintDevice::setPageSize(const QPageSize &pageSize)

Sets the page size to pageSize.

To get the current QPageSize use pageLayout().pageSize().

You should call this before calling QPainter::begin(), or immediately before calling newPage() to apply the new page size to a new page. You should not call any painting methods between a call to setPageSize() and newPage() as the wrong paint metrics may be used.

Returns true if the page size was successfully set to pageSize.

This function was introduced in Qt 5.3.

See also pageSize() and pageLayout().

### `[virtual]` void QPagedPaintDevice::setPageSize(PageSize size)

Sets the size of the a page to size.

See also setPageSizeMM().

### `[virtual]` void QPagedPaintDevice::setPageSizeMM(const QSizeF &size)

Sets the page size to size. size is specified in millimeters.

If the size matches a standard QPagedPaintDevice::PageSize then that page size will be used, otherwise QPagedPaintDevice::Custom will be set.

See also pageSizeMM().