![]() |
Qt 6.x
The Qt SDK
|
\inmodule QtGui More...
#include <qpagedpaintdevice.h>
Public Types | |
enum | PdfVersion { PdfVersion_1_4 , PdfVersion_A1b , PdfVersion_1_6 } |
The PdfVersion enum describes the version of the PDF file that is produced by QPrinter or QPdfWriter. More... | |
![]() | |
enum | PaintDeviceMetric { PdmWidth = 1 , PdmHeight , PdmWidthMM , PdmHeightMM , PdmNumColors , PdmDepth , PdmDpiX , PdmDpiY , PdmPhysicalDpiX , PdmPhysicalDpiY , PdmDevicePixelRatio , PdmDevicePixelRatioScaled } |
Public Member Functions | |
~QPagedPaintDevice () | |
Destroys the object. | |
virtual bool | newPage ()=0 |
Starts a new page. | |
virtual bool | setPageLayout (const QPageLayout &pageLayout) |
virtual bool | setPageSize (const QPageSize &pageSize) |
virtual bool | setPageOrientation (QPageLayout::Orientation orientation) |
virtual bool | setPageMargins (const QMarginsF &margins, QPageLayout::Unit units=QPageLayout::Millimeter) |
QPageLayout | pageLayout () const |
virtual void | setPageRanges (const QPageRanges &ranges) |
QPageRanges | pageRanges () const |
![]() | |
virtual | ~QPaintDevice () |
virtual int | devType () const |
bool | paintingActive () const |
virtual QPaintEngine * | paintEngine () const =0 |
int | width () const |
int | height () const |
int | widthMM () const |
int | heightMM () const |
int | logicalDpiX () const |
int | logicalDpiY () const |
int | physicalDpiX () const |
int | physicalDpiY () const |
qreal | devicePixelRatio () const |
qreal | devicePixelRatioF () const |
int | colorCount () const |
int | depth () const |
Protected Member Functions | |
QPagedPaintDevice (QPagedPaintDevicePrivate *dd) | |
QPagedPaintDevicePrivate * | dd () |
![]() | |
QPaintDevice () noexcept | |
virtual int | metric (PaintDeviceMetric metric) const |
virtual void | initPainter (QPainter *painter) const |
virtual QPaintDevice * | redirected (QPoint *offset) const |
virtual QPainter * | sharedPainter () const |
Protected Attributes | |
QPagedPaintDevicePrivate * | d |
![]() | |
ushort | painters |
Friends | |
class | QPagedPaintDevicePrivate |
Additional Inherited Members | |
![]() | |
static qreal | devicePixelRatioFScale () |
\inmodule QtGui
The QPagedPaintDevice class represents a paint device 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.
Definition at line 20 of file qpagedpaintdevice.h.
The PdfVersion enum describes the version of the PDF file that is produced by QPrinter or QPdfWriter.
\value PdfVersion_1_4 A PDF 1.4 compatible document is produced.
\value PdfVersion_A1b A PDF/A-1b compatible document is produced.
\value PdfVersion_1_6 A PDF 1.6 compatible document is produced. This value was added in Qt 5.12.
Enumerator | |
---|---|
PdfVersion_1_4 | |
PdfVersion_A1b | |
PdfVersion_1_6 |
Definition at line 28 of file qpagedpaintdevice.h.
QPagedPaintDevice::~QPagedPaintDevice | ( | ) |
|
protected |
Constructs a new paged paint device with the derived private class.
Definition at line 30 of file qpagedpaintdevice.cpp.
|
protected |
Returns the QPagedPaintDevicePrivate.
Definition at line 47 of file qpagedpaintdevice.cpp.
References d.
|
pure virtual |
Starts a new page.
Returns true
on success.
Implemented in QPdfWriter, and QPrinter.
Referenced by QTextDocument::print().
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().
Definition at line 173 of file qpagedpaintdevice.cpp.
References d, and QPagedPaintDevicePrivate::pageLayout().
Referenced by QPrintPreviewWidgetPrivate::layoutPages(), QPrintDialogPrivate::openCocoaPrintPanel(), QPrinter::pageRect(), QPrinter::paperRect(), QPrintPreviewWidgetPrivate::populateScene(), QTextDocument::print(), and QPageSetupWidget::setPrinter().
QPageRanges QPagedPaintDevice::pageRanges | ( | ) | const |
Returns the page ranges associated with this device.
Definition at line 185 of file qpagedpaintdevice.cpp.
References d, and QPagedPaintDevicePrivate::pageRanges.
Referenced by QTextDocument::print().
|
virtual |
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.
Definition at line 87 of file qpagedpaintdevice.cpp.
References d, and QPagedPaintDevicePrivate::setPageLayout().
Referenced by QPageSetupWidget::setupPrinter().
|
virtual |
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().margins().
Returns true if the page margins were successfully set to margins.
Definition at line 156 of file qpagedpaintdevice.cpp.
References d, and QPagedPaintDevicePrivate::setPageMargins().
Referenced by QTextDocument::print().
|
virtual |
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().orientation().
Returns true if the page orientation was successfully set to orientation.
Definition at line 134 of file qpagedpaintdevice.cpp.
References d, and QPagedPaintDevicePrivate::setPageOrientation().
Referenced by QPageSetupWidget::setupPrinter().
|
virtual |
Sets the page ranges for this device to ranges.
Definition at line 195 of file qpagedpaintdevice.cpp.
References d, and QPagedPaintDevicePrivate::pageRanges.
Referenced by qt_win_read_back_PRINTDLGEX().
|
virtual |
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.
Definition at line 109 of file qpagedpaintdevice.cpp.
References d, and QPagedPaintDevicePrivate::setPageSize().
|
friend |
Definition at line 42 of file qpagedpaintdevice.h.
|
protected |
Definition at line 43 of file qpagedpaintdevice.h.
Referenced by QPdfWriter::QPdfWriter(), QPdfWriter::QPdfWriter(), ~QPagedPaintDevice(), QPrinter::~QPrinter(), QPrinter::abort(), QPdfWriter::addFileAttachment(), QPrinter::collateCopies(), QPrinter::colorMode(), QPrinter::copyCount(), QPdfWriter::creator(), QPrinter::creator(), dd(), QPrinter::docName(), QPdfWriter::documentXmpMetadata(), QPrinter::duplex(), QPrinter::fontEmbeddingEnabled(), QPrinter::fromPage(), QPrinter::fullPage(), QPagedPaintDevicePrivate::get(), QPrinter::isValid(), QPdfWriter::metric(), QPrinter::metric(), QPdfWriter::newPage(), QPrinter::newPage(), QPrinter::outputFileName(), QPrinter::outputFormat(), pageLayout(), QPrinter::pageOrder(), pageRanges(), QPdfWriter::paintEngine(), QPrinter::paintEngine(), QPrinter::paperSource(), QPdfWriter::pdfVersion(), QPrinter::pdfVersion(), QPrinter::printEngine(), QPrinter::printerName(), QPrinter::printerSelectionOption(), QPrinter::printerState(), QPrinter::printProgram(), QPrinter::printRange(), QPdfWriter::resolution(), QPrinter::resolution(), QPrinter::setCollateCopies(), QPrinter::setColorMode(), QPrinter::setCopyCount(), QPrinter::setCreator(), QPdfWriter::setCreator(), QPrinter::setDocName(), QPdfWriter::setDocumentXmpMetadata(), QPrinter::setDuplex(), QPrinter::setEngines(), QPrinter::setFontEmbeddingEnabled(), QPrinter::setFromTo(), QPrinter::setFullPage(), QPrinter::setOutputFileName(), QPrinter::setOutputFormat(), setPageLayout(), setPageMargins(), QPrinter::setPageOrder(), setPageOrientation(), setPageRanges(), setPageSize(), QPrinter::setPaperSource(), QPdfWriter::setPdfVersion(), QPrinter::setPdfVersion(), QPrinter::setPrinterName(), QPrinter::setPrinterSelectionOption(), QPrinter::setPrintProgram(), QPrinter::setPrintRange(), QPdfWriter::setResolution(), QPrinter::setResolution(), QPdfWriter::setTitle(), QPrinter::supportedResolutions(), QPrinter::supportsMultipleCopies(), QPdfWriter::title(), and QPrinter::toPage().