CopperSpice API  1.8.1
QPageLayout Class Reference

Describes the size, orientation and margins of a page. More...

## Public Typedefs

using Unit = QPageSize::Unit

## Public Types

enum  Mode

enum  Orientation

## Public Methods

QPageLayout ()

QPageLayout (const QPageLayout &other)

QPageLayout (const QPageSize &pageSize, Orientation orientation, const QMarginsF &margins, Unit units=QPageSize::Unit::Point, const QMarginsF &minMargins=QMarginsF (0, 0, 0, 0))

~QPageLayout ()

QRectF fullRect () const

QRectF fullRect (Unit units) const

QRect fullRectPixels (int resolution) const

QRect fullRectPoints () const

bool isEquivalentTo (const QPageLayout &other) const

bool isValid () const

QMarginsF margins () const

QMarginsF margins (Unit units) const

QMargins marginsPixels (int resolution) const

QMargins marginsPoints () const

QMarginsF maximumMargins () const

QMarginsF minimumMargins () const

Mode mode () const

QPageLayout & operator= (const QPageLayout &other)

QPageLayout & operator= (QPageLayout &&other)

Orientation orientation () const

QPageSize pageSize () const

QRectF paintRect () const

QRectF paintRect (Unit units) const

QRect paintRectPixels (int resolution) const

QRect paintRectPoints () const

bool setBottomMargin (qreal bottomMargin)

bool setLeftMargin (qreal leftMargin)

bool setMargins (const QMarginsF &margins)

void setMinimumMargins (const QMarginsF &minMargins)

void setMode (Mode mode)

void setOrientation (Orientation orientation)

void setPageSize (const QPageSize &pageSize, const QMarginsF &minMargins=QMarginsF (0, 0, 0, 0))

bool setRightMargin (qreal rightMargin)

bool setTopMargin (qreal topMargin)

void setUnits (QPageSize::Unit units)

void swap (QPageLayout &other)

QPageSize::Unit units () const

## Friends

bool operator== (const QPageLayout &lhs, const QPageLayout &rhs)

## Related Functions

These are not member functions

bool operator!= (const QPageLayout &lhs, const QPageLayout &rhs)

## Detailed Description

Describes the size, orientation and margins of a page. The QPageLayout class defines the layout of a page in a paged document, with the page size, orientation and margins able to be set and the full page and paintable page rectangles defined by those attributes able to be queried in a variety of units.

The page size is defined by the QPageSize class which can be queried for page size attributes. Note that the QPageSize itself is always defined in a Portrait orientation.

The minimum margins can be defined for the layout but normally default to 0. When used in conjunction with printing support the minimum margins will reflect the minimum printable area defined by the printer.

In the default StandardMode the current margins and minimum margins are always taken into account. The paintable rectangle is the full page rectangle less the current margins, and the current margins can only be set to values between the minimum margins and the maximum margins allowed by the full page size.

In FullPageMode the current margins and minimum margins are not taken into account. The paintable rectangle is the full page rectangle, and the current margins can be set to any values regardless of the minimum margins and page size.

QPageSize

## Member Typedef Documentation

Typedef for QPageSize::Unit.

## Member Enumeration Documentation

 enum QPageLayout::Mode

Defines the page layout mode.

Constant Value Description
QPageLayout::StandardMode 0 Paint rectangle includes margins, margins must fall between the minimum and maximum
QPageLayout::FullPageMode 1 Paint rectangle excludes margins, margins can be any value and must be managed manually

This enum type is used to specify each page's orientation. This type interacts with QPrinter::PaperSize and QPrinter::setFullPage() to determine the final size of the page available to the application.

ConstantValueDescription
QPageLayout::Portrait 0 Page height is greater than width
QPageLayout::Landscape 1 Page width is greater than height

## Constructor & Destructor Documentation

 QPageLayout::QPageLayout ( )

Creates an invalid QPageLayout.

 QPageLayout::QPageLayout ( const QPageSize & pageSize, Orientation orientation, const QMarginsF & margins, Unit units = QPageSize::Unit::Point, const QMarginsF & minMargins = QMarginsF(0, 0, 0, 0) )

Creates a QPageLayout with the given pageSize, orientation and margins in the given units. The constructed QPageLayout will be in StandardMode.

Optionally the minimum allowed margins minMargins can be defined. These are the minimum margins supported by the physical print device. The margins given will be clamped to the minimum margins and the maximum margins allowed by the page size.

 QPageLayout::QPageLayout ( const QPageLayout & other )

Copy constructs a new QPageLayout from other.

 QPageLayout::~QPageLayout ( )

Destroys the page layout.

## Method Documentation

 QRectF QPageLayout::fullRect ( ) const

Returns the full page rectangle in the current layout units. The page rectangle takes into account the page size and page orientation, but not the page margins.

paintRect(), units()
 QRectF QPageLayout::fullRect ( Unit units ) const

Returns the full page rectangle in the required units. The page rectangle takes into account the page size and page orientation, but not the page margins.

paintRect()
 QRect QPageLayout::fullRectPixels ( int resolution ) const

Returns the full page rectangle in device pixels for the given resolution.

The page rectangle takes into account the page size and page orientation, but not the page margins.

paintRect()
 QRect QPageLayout::fullRectPoints ( ) const

Returns the full page rectangle in Postscript Points (1/72nd of an inch).

The page rectangle takes into account the page size and page orientation, but not the page margins.

paintRect()
 bool QPageLayout::isEquivalentTo ( const QPageLayout & other ) const

Returns true if this page layout is equivalent to the other page layout, i.e. if the page has the same size, margins and orientation.

 bool QPageLayout::isValid ( ) const

 QMarginsF QPageLayout::margins ( ) const

Returns the margins of the page layout using the currently set units.

setMargins(), units()
 QMarginsF QPageLayout::margins ( Unit units ) const

Returns the margins of the page layout using the requested units.

setMargins(), margins()
 QMargins QPageLayout::marginsPixels ( int resolution ) const

Returns the margins of the page layout in device pixels for the given resolution.

setMargins()
 QMargins QPageLayout::marginsPoints ( ) const

Returns the margins of the page layout in Postscript Points (1/72nd of an inch).

setMargins(), margins()
 QMarginsF QPageLayout::maximumMargins ( ) const

Returns the maximum margins that would be applied if the page layout was in StandardMode.

The maximum margins allowed are calculated as the full size of the page minus the minimum margins set. For example, if the page width is 100 points and the minimum right margin is 10 points, then the maximum left margin will be 90 points.

setMinimumMargins(), minimumMargins()
 QMarginsF QPageLayout::minimumMargins ( ) const

Returns the minimum margins of the page layout.

setMinimumMargins(), maximumMargins()
 Mode QPageLayout::mode ( ) const

Returns the page layout mode.

setMode()
 QPageLayout & QPageLayout::operator= ( const QPageLayout & other )

Copy assigns from other and returns a reference to this object.

 QPageLayout & QPageLayout::operator= ( QPageLayout && other )
inline

Move assigns from other and returns a reference to this object.

 Orientation QPageLayout::orientation ( ) const

Returns the page orientation of the page layout.

setOrientation()
 QPageSize QPageLayout::pageSize ( ) const

Returns the page size of the page layout.

Note that the QPageSize is always defined in a Portrait orientation. To obtain a size that takes the set orientation into account you must use fullRect().

setPageSize()
 QRectF QPageLayout::paintRect ( ) const

Returns the page rectangle in the current layout units.

The paintable rectangle takes into account the page size, orientation and margins.

If the FullPageMode mode is set then the fullRect() is returned and the margins must be manually managed.

 QRectF QPageLayout::paintRect ( Unit units ) const

Returns the page rectangle in the required units.

The paintable rectangle takes into account the page size, orientation and margins. If the FullPageMode mode is set then the fullRect() is returned and the margins must be manually managed.

 QRect QPageLayout::paintRectPixels ( int resolution ) const

Returns the paintable rectangle in rounded device pixels for the given resolution.

The paintable rectangle takes into account the page size, orientation and margins. If the FullPageMode mode is set then the fullRect() is returned and the margins must be manually managed.

 QRect QPageLayout::paintRectPoints ( ) const

Returns the paintable rectangle in rounded Postscript Points (1/72nd of an inch).

The paintable rectangle takes into account the page size, orientation and margins. If the FullPageMode mode is set then the fullRect() is returned and the margins must be manually managed.

 bool QPageLayout::setBottomMargin ( qreal bottomMargin )

Sets the bottom page margin of the page layout to bottomMargin. Returns true if the margin was successfully set.

The units used are those currently defined for the layout. To use different units call setUnits() first.

If in the default StandardMode then the new margin must fall between the minimum margin set and the maximum margin allowed by the page size, otherwise the margin will not be set. If in FullPageMode then any margin values will be accepted.

setMargins(), margins()
 bool QPageLayout::setLeftMargin ( qreal leftMargin )

Sets the left page margin of the page layout to leftMargin. Returns true if the margin was successfully set.

The units used are those currently defined for the layout. To use different units call setUnits() first.

If in the default StandardMode then the new margin must fall between the minimum margin set and the maximum margin allowed by the page size, otherwise the margin will not be set. If in FullPageMode then any margin values will be accepted.

setMargins(), margins()
 bool QPageLayout::setMargins ( const QMarginsF & margins )

Sets the page margins of the page layout to margins.Returns true if the margins were successfully set.

The units used are those currently defined for the layout. To use different units then call setUnits() first.

If in the default StandardMode then all the new margins must fall between the minimum margins set and the maximum margins allowed by the page size, otherwise the margins will not be set. If in FullPageMode then any margin values will be accepted.

margins(), units()
 void QPageLayout::setMinimumMargins ( const QMarginsF & minMargins )

Sets the minimum page margins of the page layout to minMargins.

It is not recommended to override the default values set for a page size as this may be the minimum printable area for a physical print device.

If the StandardMode mode is set then the existing margins will be clamped to the new minMargins and the maximum allowed by the page size. If the FullPageMode is set then the existing margins will be unchanged.

minimumMargins(), setMargins()
 void QPageLayout::setMode ( Mode mode )

Sets a page layout mode to mode.

mode()
 void QPageLayout::setOrientation ( Orientation orientation )

Sets the page orientation of the page layout to orientation.

Changing the orientation does not affect the current margins or the minimum margins.

orientation()
 void QPageLayout::setPageSize ( const QPageSize & pageSize, const QMarginsF & minMargins = QMarginsF(0, 0, 0, 0) )

Sets the page size of the page layout to pageSize.

Optionally define the minimum allowed margins minMargins, e.g. the minimum margins able to be printed by a physical print device, otherwise the minimum margins will default to 0.

If StandardMode is set then the existing margins will be clamped to the new minimum margins and the maximum margins allowed by the page size. If FullPageMode is set then the existing margins will be unchanged.

pageSize()
 bool QPageLayout::setRightMargin ( qreal rightMargin )

Sets the right page margin of the page layout to rightMargin. Returns true if the margin was successfully set.

The units used are those currently defined for the layout. To use different units call setUnits() first.

If in the default StandardMode then the new margin must fall between the minimum margin set and the maximum margin allowed by the page size, otherwise the margin will not be set. If in FullPageMode then any margin values will be accepted.

setMargins(), margins()
 bool QPageLayout::setTopMargin ( qreal topMargin )

Sets the top page margin of the page layout to topMargin. Returns true if the margin was successfully set.

The units used are those currently defined for the layout. To use different units call setUnits() first.

If in the default StandardMode then the new margin must fall between the minimum margin set and the maximum margin allowed by the page size, otherwise the margin will not be set. If in FullPageMode then any margin values will be accepted.

setMargins(), margins()
 void QPageLayout::setUnits ( QPageSize::Unit units )

Sets the units used to define the page layout.

units()
 void QPageLayout::swap ( QPageLayout & other )
inline

Swaps this page layout with other. This function is very fast and never fails. Unit QPageLayout::units() const

Returns the units the page layout is currently defined in.

setUnits()
 QPageSize::Unit QPageLayout::units ( ) const

Returns the units the page layout is defined in.

units()

## Friends And Related Function Documentation

 bool operator!= ( const QPageLayout & lhs, const QPageLayout & rhs )
related

Returns true if page layout lhs is not equal to page layout rhs, which means any of the attributes differ.

This comparison is a strict equality. The QPageSize ID, name and size must exactly match as well as the margins and the units.