Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
QPagedPaintDevice Class Referenceabstract

\inmodule QtGui More...

#include <qpagedpaintdevice.h>

+ Inheritance diagram for QPagedPaintDevice:
+ Collaboration diagram for QPagedPaintDevice:

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...
 
- Public Types inherited from QPaintDevice
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
 
- Public Member Functions inherited from QPaintDevice
virtual ~QPaintDevice ()
 
virtual int devType () const
 
bool paintingActive () const
 
virtual QPaintEnginepaintEngine () 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)
 
QPagedPaintDevicePrivatedd ()
 
- Protected Member Functions inherited from QPaintDevice
 QPaintDevice () noexcept
 
virtual int metric (PaintDeviceMetric metric) const
 
virtual void initPainter (QPainter *painter) const
 
virtual QPaintDeviceredirected (QPoint *offset) const
 
virtual QPaintersharedPainter () const
 

Protected Attributes

QPagedPaintDevicePrivated
 
- Protected Attributes inherited from QPaintDevice
ushort painters
 

Friends

class QPagedPaintDevicePrivate
 

Additional Inherited Members

- Static Public Member Functions inherited from QPaintDevice
static qreal devicePixelRatioFScale ()
 

Detailed Description

\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.

Member Enumeration Documentation

◆ PdfVersion

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.

Constructor & Destructor Documentation

◆ ~QPagedPaintDevice()

QPagedPaintDevice::~QPagedPaintDevice ( )

Destroys the object.

Definition at line 38 of file qpagedpaintdevice.cpp.

References d.

◆ QPagedPaintDevice()

QPagedPaintDevice::QPagedPaintDevice ( QPagedPaintDevicePrivate * dd)
protected

Constructs a new paged paint device with the derived private class.

Definition at line 30 of file qpagedpaintdevice.cpp.

Member Function Documentation

◆ dd()

QPagedPaintDevicePrivate * QPagedPaintDevice::dd ( )
protected

Returns the QPagedPaintDevicePrivate.

Definition at line 47 of file qpagedpaintdevice.cpp.

References d.

◆ newPage()

bool QPagedPaintDevice::newPage ( )
pure virtual

Starts a new page.

Returns true on success.

Implemented in QPdfWriter, and QPrinter.

Referenced by QTextDocument::print().

+ Here is the caller graph for this function:

◆ pageLayout()

QPageLayout QPagedPaintDevice::pageLayout ( ) const
Since
5.3

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().

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

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pageRanges()

QPageRanges QPagedPaintDevice::pageRanges ( ) const
Since
6.0

Returns the page ranges associated with this device.

See also
QPageRanges, QPrinter::fromPage(), QPrinter::toPage()

Definition at line 185 of file qpagedpaintdevice.cpp.

References d, and QPagedPaintDevicePrivate::pageRanges.

Referenced by QTextDocument::print().

+ Here is the caller graph for this function:

◆ setPageLayout()

bool QPagedPaintDevice::setPageLayout ( const QPageLayout & newPageLayout)
virtual
Since
5.3

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.

See also
pageLayout()

Definition at line 87 of file qpagedpaintdevice.cpp.

References d, and QPagedPaintDevicePrivate::setPageLayout().

Referenced by QPageSetupWidget::setupPrinter().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setPageMargins()

bool QPagedPaintDevice::setPageMargins ( const QMarginsF & margins,
QPageLayout::Unit units = QPageLayout::Millimeter )
virtual
Since
5.3

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.

See also
pageLayout()

Definition at line 156 of file qpagedpaintdevice.cpp.

References d, and QPagedPaintDevicePrivate::setPageMargins().

Referenced by QTextDocument::print().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setPageOrientation()

bool QPagedPaintDevice::setPageOrientation ( QPageLayout::Orientation orientation)
virtual
Since
5.3

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.

See also
pageLayout()

Definition at line 134 of file qpagedpaintdevice.cpp.

References d, and QPagedPaintDevicePrivate::setPageOrientation().

Referenced by QPageSetupWidget::setupPrinter().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setPageRanges()

void QPagedPaintDevice::setPageRanges ( const QPageRanges & ranges)
virtual
Since
6.0

Sets the page ranges for this device to ranges.

Definition at line 195 of file qpagedpaintdevice.cpp.

References d, and QPagedPaintDevicePrivate::pageRanges.

◆ setPageSize()

bool QPagedPaintDevice::setPageSize ( const QPageSize & pageSize)
virtual
Since
5.3

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.

See also
pageLayout()

Definition at line 109 of file qpagedpaintdevice.cpp.

References d, and QPagedPaintDevicePrivate::setPageSize().

+ Here is the call graph for this function:

Friends And Related Symbol Documentation

◆ QPagedPaintDevicePrivate

friend class QPagedPaintDevicePrivate
friend

Definition at line 42 of file qpagedpaintdevice.h.

Member Data Documentation

◆ d

QPagedPaintDevicePrivate* QPagedPaintDevice::d
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(), QPdfWriter::colorModel(), 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(), QPrintDialogPrivate::selectPrinter(), QPrinter::setCollateCopies(), QPrinter::setColorMode(), QPdfWriter::setColorModel(), 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().


The documentation for this class was generated from the following files: