QPagedPaintDevice Class

The QPagedPaintDevice class represents a paint device that supports multiple pages. More...

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

QPdfWriter

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:

ConstantValueDescription
QPagedPaintDevice::A05841 x 1189 mm
QPagedPaintDevice::A16594 x 841 mm
QPagedPaintDevice::A27420 x 594 mm
QPagedPaintDevice::A38297 x 420 mm
QPagedPaintDevice::A40210 x 297 mm, 8.26 x 11.69 inches
QPagedPaintDevice::A59148 x 210 mm
QPagedPaintDevice::A610105 x 148 mm
QPagedPaintDevice::A71174 x 105 mm
QPagedPaintDevice::A81252 x 74 mm
QPagedPaintDevice::A91337 x 52 mm
QPagedPaintDevice::B0141000 x 1414 mm
QPagedPaintDevice::B115707 x 1000 mm
QPagedPaintDevice::B217500 x 707 mm
QPagedPaintDevice::B318353 x 500 mm
QPagedPaintDevice::B419250 x 353 mm
QPagedPaintDevice::B51176 x 250 mm, 6.93 x 9.84 inches
QPagedPaintDevice::B620125 x 176 mm
QPagedPaintDevice::B72188 x 125 mm
QPagedPaintDevice::B82262 x 88 mm
QPagedPaintDevice::B92333 x 62 mm
QPagedPaintDevice::B101631 x 44 mm
QPagedPaintDevice::C5E24163 x 229 mm
QPagedPaintDevice::Comm10E25105 x 241 mm, U.S. Common 10 Envelope
QPagedPaintDevice::DLE26110 x 220 mm
QPagedPaintDevice::Executive47.5 x 10 inches, 190.5 x 254 mm
QPagedPaintDevice::Folio27210 x 330 mm
QPagedPaintDevice::Ledger28431.8 x 279.4 mm
QPagedPaintDevice::Legal38.5 x 14 inches, 215.9 x 355.6 mm
QPagedPaintDevice::Letter28.5 x 11 inches, 215.9 x 279.4 mm
QPagedPaintDevice::Tabloid29279.4 x 431.8 mm
QPagedPaintDevice::Custom30Unknown, or a user defined size.
QPagedPaintDevice::A1031聽
QPagedPaintDevice::A3Extra32聽
QPagedPaintDevice::A4Extra33聽
QPagedPaintDevice::A4Plus34聽
QPagedPaintDevice::A4Small35聽
QPagedPaintDevice::A5Extra36聽
QPagedPaintDevice::B5Extra37聽
QPagedPaintDevice::JisB038聽
QPagedPaintDevice::JisB139聽
QPagedPaintDevice::JisB240聽
QPagedPaintDevice::JisB341聽
QPagedPaintDevice::JisB442聽
QPagedPaintDevice::JisB543聽
QPagedPaintDevice::JisB644,
QPagedPaintDevice::JisB745聽
QPagedPaintDevice::JisB846聽
QPagedPaintDevice::JisB947聽
QPagedPaintDevice::JisB1048聽
QPagedPaintDevice::AnsiALetter= Letter
QPagedPaintDevice::AnsiBLedger= Ledger
QPagedPaintDevice::AnsiC49聽
QPagedPaintDevice::AnsiD50聽
QPagedPaintDevice::AnsiE51聽
QPagedPaintDevice::LegalExtra52聽
QPagedPaintDevice::LetterExtra53聽
QPagedPaintDevice::LetterPlus54聽
QPagedPaintDevice::LetterSmall55聽
QPagedPaintDevice::TabloidExtra56聽
QPagedPaintDevice::ArchA57聽
QPagedPaintDevice::ArchB58聽
QPagedPaintDevice::ArchC59聽
QPagedPaintDevice::ArchD60聽
QPagedPaintDevice::ArchE61聽
QPagedPaintDevice::Imperial7x962聽
QPagedPaintDevice::Imperial8x1063聽
QPagedPaintDevice::Imperial9x1164聽
QPagedPaintDevice::Imperial9x1265聽
QPagedPaintDevice::Imperial10x1166聽
QPagedPaintDevice::Imperial10x1367聽
QPagedPaintDevice::Imperial10x1468聽
QPagedPaintDevice::Imperial12x1169聽
QPagedPaintDevice::Imperial15x1170聽
QPagedPaintDevice::ExecutiveStandard71聽
QPagedPaintDevice::Note72聽
QPagedPaintDevice::Quarto73聽
QPagedPaintDevice::Statement74聽
QPagedPaintDevice::SuperA75聽
QPagedPaintDevice::SuperB76聽
QPagedPaintDevice::Postcard77聽
QPagedPaintDevice::DoublePostcard78聽
QPagedPaintDevice::Prc16K79聽
QPagedPaintDevice::Prc32K80聽
QPagedPaintDevice::Prc32KBig81聽
QPagedPaintDevice::FanFoldUS82聽
QPagedPaintDevice::FanFoldGerman83聽
QPagedPaintDevice::FanFoldGermanLegal84聽
QPagedPaintDevice::EnvelopeB485聽
QPagedPaintDevice::EnvelopeB586聽
QPagedPaintDevice::EnvelopeB687聽
QPagedPaintDevice::EnvelopeC088聽
QPagedPaintDevice::EnvelopeC189聽
QPagedPaintDevice::EnvelopeC290聽
QPagedPaintDevice::EnvelopeC391聽
QPagedPaintDevice::EnvelopeC492聽
QPagedPaintDevice::EnvelopeC5C5E= C5E
QPagedPaintDevice::EnvelopeC693聽
QPagedPaintDevice::EnvelopeC6594聽
QPagedPaintDevice::EnvelopeC795聽
QPagedPaintDevice::EnvelopeDLDLE= DLE
QPagedPaintDevice::Envelope996聽
QPagedPaintDevice::Envelope10Comm10E= Comm10E
QPagedPaintDevice::Envelope1197聽
QPagedPaintDevice::Envelope1298聽
QPagedPaintDevice::Envelope1499聽
QPagedPaintDevice::EnvelopeMonarch100聽
QPagedPaintDevice::EnvelopePersonal101聽
QPagedPaintDevice::EnvelopeChou3102聽
QPagedPaintDevice::EnvelopeChou4103聽
QPagedPaintDevice::EnvelopeInvite104聽
QPagedPaintDevice::EnvelopeItalian105聽
QPagedPaintDevice::EnvelopeKaku2106聽
QPagedPaintDevice::EnvelopeKaku3107聽
QPagedPaintDevice::EnvelopePrc1108聽
QPagedPaintDevice::EnvelopePrc2109聽
QPagedPaintDevice::EnvelopePrc3110聽
QPagedPaintDevice::EnvelopePrc4111聽
QPagedPaintDevice::EnvelopePrc5112聽
QPagedPaintDevice::EnvelopePrc6113聽
QPagedPaintDevice::EnvelopePrc7114聽
QPagedPaintDevice::EnvelopePrc8115聽
QPagedPaintDevice::EnvelopePrc9116聽
QPagedPaintDevice::EnvelopePrc10117聽
QPagedPaintDevice::EnvelopeYou4118聽
QPagedPaintDevice::LastPageSizeEnvelopeYou4= 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.

ConstantValueDescription
QPagedPaintDevice::PdfVersion_1_40A PDF 1.4 compatible document is produced.
QPagedPaintDevice::PdfVersion_A1b1A PDF/A-1b compatible document is produced.
QPagedPaintDevice::PdfVersion_1_62A 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.