内容表

上一话题

QOpenGLWindow

下一话题

QPageSize

QPageLayout

描述页面大小、取向和边距。 更多

Inheritance diagram of PySide2.QtGui.QPageLayout

概要

函数

详细描述

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 Qt’s 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.

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

class QPageLayout

QPageLayout(other)

QPageLayout(pageSize, orientation, margins[, units=Point[, minMargins=QMarginsF(0, 0, 0, 0)]])

param minMargins

QMarginsF

param other

QPageLayout

param orientation

取向

param units

Unit

param pageSize

QPageSize

param margins

QMarginsF

Creates an invalid QPageLayout .

Copy constructor, copies other to this.

创建 QPageLayout 采用给定 pageSize , orientation and margins 以给定 units .

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

The constructed QPageLayout will be in StandardMode .

margins given will be clamped to the minimum margins and the maximum margins allowed by the page size.

PySide2.QtGui.QPageLayout. Unit

This enum type is used to specify the measurement unit for page layout and margins.

常量

描述

QPageLayout.Millimeter

QPageLayout.Point

1/72th of an inch

QPageLayout.Inch

QPageLayout.Pica

1/72th of a foot, 1/6th of an inch, 12 Points

QPageLayout.Didot

1/72th of a French inch, 0.375 mm

QPageLayout.Cicero

1/6th of a French inch, 12 Didot, 4.5mm

PySide2.QtGui.QPageLayout. 取向

This enum type defines the page orientation

常量

描述

QPageLayout.Portrait

The page size is used in its default orientation

QPageLayout.Landscape

The page size is rotated through 90 degrees

Note that some standard page sizes are defined with a width larger than their height, hence the orientation is defined relative to the standard page size and not using the relative page dimensions.

PySide2.QtGui.QPageLayout. 模式

定义页面布局模式

常量

描述

QPageLayout.StandardMode

Paint Rect includes margins, margins must fall between the minimum and maximum.

QPageLayout.FullPageMode

Paint Rect excludes margins, margins can be any value and must be managed manually.

PySide2.QtGui.QPageLayout. fullRect ( )
返回类型

QRectF

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.

PySide2.QtGui.QPageLayout. fullRect ( units )
参数

units Unit

返回类型

QRectF

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

PySide2.QtGui.QPageLayout. fullRectPixels ( resolution )
参数

resolution int

返回类型

QRect

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

PySide2.QtGui.QPageLayout. fullRectPoints ( )
返回类型

QRect

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

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

另请参阅

paintRect()

PySide2.QtGui.QPageLayout. isEquivalentTo ( other )
参数

other QPageLayout

返回类型

bool

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

PySide2.QtGui.QPageLayout. isValid ( )
返回类型

bool

返回 true if this page layout is valid.

PySide2.QtGui.QPageLayout. margins ( )
返回类型

QMarginsF

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

PySide2.QtGui.QPageLayout. margins ( units )
参数

units Unit

返回类型

QMarginsF

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

PySide2.QtGui.QPageLayout. marginsPixels ( resolution )
参数

resolution int

返回类型

QMargins

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

另请参阅

setMargins()

PySide2.QtGui.QPageLayout. marginsPoints ( )
返回类型

QMargins

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

PySide2.QtGui.QPageLayout. maximumMargins ( )
返回类型

QMarginsF

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.

PySide2.QtGui.QPageLayout. minimumMargins ( )
返回类型

QMarginsF

Returns the minimum margins of the page layout.

PySide2.QtGui.QPageLayout. mode ( )
返回类型

模式

Returns the page layout mode.

另请参阅

setMode()

PySide2.QtGui.QPageLayout. __ne__ ( rhs )
参数

rhs QPageLayout

返回类型

bool

PySide2.QtGui.QPageLayout. __eq__ ( rhs )
参数

rhs QPageLayout

返回类型

bool

PySide2.QtGui.QPageLayout. orientation ( )
返回类型

取向

Returns the page orientation of the page layout.

另请参阅

setOrientation()

PySide2.QtGui.QPageLayout. pageSize ( )
返回类型

QPageSize

Returns the page size of the page layout.

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

另请参阅

setPageSize()

PySide2.QtGui.QPageLayout. paintRect ( )
返回类型

QRectF

Returns the page rectangle in the current layout units.

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

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

PySide2.QtGui.QPageLayout. paintRect ( units )
参数

units Unit

返回类型

QRectF

Returns the page rectangle in the required units .

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

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

PySide2.QtGui.QPageLayout. paintRectPixels ( resolution )
参数

resolution int

返回类型

QRect

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

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

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

PySide2.QtGui.QPageLayout. paintRectPoints ( )
返回类型

QRect

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

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

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

PySide2.QtGui.QPageLayout. setBottomMargin ( bottomMargin )
参数

bottomMargin qreal

返回类型

bool

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.

PySide2.QtGui.QPageLayout. setLeftMargin ( leftMargin )
参数

leftMargin qreal

返回类型

bool

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.

PySide2.QtGui.QPageLayout. setMargins ( margins )
参数

margins QMarginsF

返回类型

bool

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.

PySide2.QtGui.QPageLayout. setMinimumMargins ( minMargins )
参数

minMargins QMarginsF

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.

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.

PySide2.QtGui.QPageLayout. setMode ( mode )
参数

mode 模式

Sets a page layout mode to mode .

另请参阅

mode()

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

PySide2.QtGui.QPageLayout. setPageSize ( pageSize [ , 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.

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

PySide2.QtGui.QPageLayout. setRightMargin ( rightMargin )
参数

rightMargin qreal

返回类型

bool

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.

PySide2.QtGui.QPageLayout. setTopMargin ( topMargin )
参数

topMargin qreal

返回类型

bool

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.

PySide2.QtGui.QPageLayout. setUnits ( units )
参数

units Unit

设置 units used to define the page layout.

另请参阅

units()

PySide2.QtGui.QPageLayout. swap ( other )
参数

other QPageLayout

Swaps this page layout with other 。此函数非常快,且从不失败。

PySide2.QtGui.QPageLayout. units ( )
返回类型

Unit

Returns the units the page layout is currently defined in.

另请参阅

setUnits()