QPagedPaintDevice Class
The QPagedPaintDevice class represents a paint device that supports multiple pages. More...
Header: | #include <QPagedPaintDevice> |
qmake: | QT += gui |
Inherits: | QPaintDevice |
Inherited By: |
Public Types
enum | PageSize { A0, A1, A2, A3, A4, …, LastPageSize } |
enum | PdfVersion { PdfVersion_1_4, PdfVersion_A1b, PdfVersion_1_6 } |
Public Functions
virtual | ~QPagedPaintDevice() |
QPagedPaintDevice::Margins | margins() const |
virtual bool | newPage() = 0 |
QPageLayout | pageLayout() const |
QPagedPaintDevice::PageSize | pageSize() const |
QSizeF | pageSizeMM() const |
virtual void | setMargins(const QPagedPaintDevice::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(QPagedPaintDevice::PageSize size) |
virtual void | setPageSizeMM(const QSizeF &size) |
Detailed Description
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.
enum QPagedPaintDevice::PdfVersion
The PdfVersion enum describes the version of the PDF file that is produced by QPrinter or QPdfWriter.
Constant | Value | Description |
---|---|---|
QPagedPaintDevice::PdfVersion_1_4 | 0 | A PDF 1.4 compatible document is produced. |
QPagedPaintDevice::PdfVersion_A1b | 1 | A PDF/A-1b compatible document is produced. |
QPagedPaintDevice::PdfVersion_1_6 | 2 | A PDF 1.6 compatible document is produced. This value was added in Qt 5.12. |
Member Function Documentation
[virtual]
QPagedPaintDevice::~QPagedPaintDevice()
Destroys the object.
QPagedPaintDevice::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().
QPagedPaintDevice::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 QPagedPaintDevice::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(QPagedPaintDevice::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().
© 2020 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.