Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
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 , PdfVersion_X4 }
 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 ,
  PdmDevicePixelRatioF_EncodedA , PdmDevicePixelRatioF_EncodedB
}

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
double getDecodedMetricF (PaintDeviceMetric metricA, PaintDeviceMetric metricB) 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 ()
static int encodeMetricF (PaintDeviceMetric metric, double value)

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.

\value [since 6.8] PdfVersion_X4 A PDF/X-4 compatible document is produced.

Enumerator
PdfVersion_1_4 
PdfVersion_A1b 
PdfVersion_1_6 
PdfVersion_X4 

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.

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

◆ newPage()

virtual bool QPagedPaintDevice::newPage ( )
pure virtual

Starts a new page.

Returns true on success.

Implemented in QPdfWriter, and QPrinter.

◆ 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 176 of file qpagedpaintdevice.cpp.

◆ 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 188 of file qpagedpaintdevice.cpp.

◆ 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 90 of file qpagedpaintdevice.cpp.

◆ 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 159 of file qpagedpaintdevice.cpp.

◆ 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 137 of file qpagedpaintdevice.cpp.

◆ setPageRanges()

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

Sets the page ranges for this device to ranges.

Definition at line 198 of file qpagedpaintdevice.cpp.

◆ 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 112 of file qpagedpaintdevice.cpp.

◆ QPagedPaintDevicePrivate

friend class QPagedPaintDevicePrivate
friend

Definition at line 47 of file qpagedpaintdevice.h.

Member Data Documentation

◆ d

QPagedPaintDevicePrivate* QPagedPaintDevice::d
protected

Definition at line 48 of file qpagedpaintdevice.h.


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