CopperSpice API  1.9.1
QPagedPaintDevice Class Referenceabstract

Represents a paint device which supports multiple pages. More...

Inheritance diagram for QPagedPaintDevice:
QPaintDevice QPdfWriter QPrinter

Public Methods

 QPagedPaintDevice ()
 
 ~QPagedPaintDevice ()
 
QMarginsF margins () const
 
virtual bool newPage () = 0
 
virtual QPageLayout pageLayout () const
 
QPageSize::PageSizeId pageSize () const
 
QSizeF pageSizeMM () const
 
virtual void setMargins (const QMarginsF &margins)
 
virtual bool setPageLayout (const QPageLayout &pageLayout)
 
virtual bool setPageMargins (const QMarginsF &margins)
 
virtual bool setPageMargins (const QMarginsF &margins, QPageLayout::Unit units)
 
virtual bool setPageOrientation (QPageLayout::Orientation orientation)
 
virtual bool setPageSize (const QPageSize &size)
 
virtual void setPageSize (QPageSize::PageSizeId sizeId)
 
virtual void setPageSizeMM (const QSizeF &size)
 
- Public Methods inherited from QPaintDevice
virtual ~QPaintDevice ()
 
int colorCount () const
 
int depth () const
 
int devicePixelRatio () const
 
qreal devicePixelRatioF () const
 
int height () const
 
int heightMM () const
 
int logicalDpiX () const
 
int logicalDpiY () const
 
virtual QPaintEnginepaintEngine () const = 0
 
bool paintingActive () const
 
int physicalDpiX () const
 
int physicalDpiY () const
 
int width () const
 
int widthMM () const
 

Additional Inherited Members

- Public Types inherited from QPaintDevice
enum  PaintDeviceMetric
 
- Protected Methods inherited from QPaintDevice
 QPaintDevice ()
 
virtual int metric (PaintDeviceMetric metric) const
 

Detailed Description

The QPagedPaintDevice class represents a paintdevice that supports multiple pages. Paged paint devices are used to generate output for printing or for formats like PDF. QPdfWriter and QPrinter inherit from this class.

Constructor & Destructor Documentation

QPagedPaintDevice::QPagedPaintDevice ( )

Constructs a new QPagedPaintDevice.

QPagedPaintDevice::~QPagedPaintDevice ( )

Deletes the current object.

Method Documentation

QMarginsF QPagedPaintDevice::margins ( ) const

Returns the current margins of the paint device. The default is 0.

Margins are specified in millimeters.

See also
setMargins()
bool QPagedPaintDevice::newPage ( )
pure virtual

Starts a new page. Returns true on success.

Implemented in QPrinter::newPage(), QPdfWriter::newPage()

QPageLayout QPagedPaintDevice::pageLayout ( ) const
virtual

Returns the current page layout.

Use this method to access the current QPageSize, QMarginsF, QPageLayout::Orientation, QPageLayout::fullRect(), and QPageLayout::paintRect().

Since the return value is a copy of the current page layout, modifying properties will not affect the paint device. To change the print settings use methods like QPdfWriter::setPageMargins() or QPdfWriter::setPageLayout().

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

Reimplemented in QPrinter::pageLayout(), QPdfWriter::pageLayout()

QPageSize::PageSizeId QPagedPaintDevice::pageSize ( ) const

Returns the currently used page size as an enum.

See also
setPageSize()
QSizeF QPagedPaintDevice::pageSizeMM ( ) const

Returns the page size in millimeters.

See also
setPageSizeMM()
void QPagedPaintDevice::setMargins ( const QMarginsF margins)
virtual

Sets the page margins using margins. Margins are specified in millimeters. The margins are a hint to drawing methods and do not affect the coordinate system or clipping.

See also
margins()

Reimplemented in QPrinter::setMargins(), QPdfWriter::setMargins()

bool QPagedPaintDevice::setPageLayout ( const QPageLayout pageLayout)
virtual

Sets the page layout to pageLayout. Returns true if the page layout was successfully set to newPageLayout.

You should call this method 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.

See also
pageLayout()

Reimplemented in QPrinter::setPageLayout(), QPdfWriter::setPageLayout()

bool QPagedPaintDevice::setPageMargins ( const QMarginsF margins)
virtual

Sets the page margins in the current page layout units. Returns true if the page margins was successfully set to margins.

You should call this method 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 QPageLayout::pageMargins().

See also
pageLayout()

Reimplemented in QPrinter::setPageMargins(), QPdfWriter::setPageMargins()

bool QPagedPaintDevice::setPageMargins ( const QMarginsF margins,
QPageLayout::Unit  units 
)
virtual

Sets the page margins defined in the given units. Returns true if the page margins were successfully set to margins.

You should call this method 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 QPageLayout::margins().

See also
pageLayout()

Reimplemented in QPrinter::setPageMargins(), QPdfWriter::setPageMargins()

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

Sets the page orientation. Returns true if the page orientation was successfully set to orientation.

The page orientation is used to define the orientation of the page size when obtaining the page rect.

You should call this method 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 QPageLayout::orientation().

See also
pageLayout()

Reimplemented in QPrinter::setPageOrientation(), QPdfWriter::setPageOrientation()

bool QPagedPaintDevice::setPageSize ( const QPageSize size)
virtual

Sets the page size to size. To get the current QPageSize use QPageLayout::pageSize(). Returns true if the page size was successfully set to pageSize.

You should call this method 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.

See also
pageLayout()

Reimplemented in QPdfWriter::setPageSize(), QPrinter::setPageSize()

void QPagedPaintDevice::setPageSize ( QPageSize::PageSizeId  sizeId)
virtual

Sets the page size using the page size enum value of sizeId.

Reimplemented in QPrinter::setPageSize(), QPdfWriter::setPageSize()

void QPagedPaintDevice::setPageSizeMM ( const QSizeF size)
virtual

Sets the page size to size. size is specified in millimeters. If the size matches a standard QPageSize::PageSizeId then the page size will be used, otherwise the enum value of QPageSize::Custom will be set.

See also
pageSizeMM()

Reimplemented in QPrinter::setPageSizeMM(), QPdfWriter::setPageSizeMM()