Class: QgsLayoutItemPage¶
Item representing the paper in a layout.
Class Hierarchy¶
Base classes¶
Base class for graphical items within a |
|
A base class for objects which belong to a layout. |
|
Abstract interface for generating an expression context. |
|
Interface for layout objects which support undo/redo commands. |
Methods
Returns the page orientation. |
|
Returns the page layout for the page, suitable to pass to QPrinter.setPageLayout |
|
Returns the size of the page. |
|
Returns the symbol to use for drawing the page background. |
|
Sets the size of the page. |
|
Sets the symbol to use for drawing the page background. |
Static Methods
Returns a new page item for the specified layout. |
|
Decodes a string representing a page orientation. |
Attributes
- class qgis.core.QgsLayoutItemPage[source]¶
Bases:
QgsLayoutItem
- __init__(layout: QgsLayout | None)
Constructor for QgsLayoutItemPage, with the specified parent
layout
.- Parameters:
layout (Optional[QgsLayout])
- Landscape = 1¶
- class Orientation¶
Bases:
int
- Portrait = 0¶
- UndoPageSymbol = 3000¶
- static create(layout: QgsLayout | None) QgsLayoutItemPage | None [source]¶
Returns a new page item for the specified
layout
.The caller takes responsibility for deleting the returned object.
- Parameters:
layout (Optional[QgsLayout])
- Return type:
Optional[QgsLayoutItemPage]
- static decodePageOrientation(string: str | None)[source]¶
Decodes a
string
representing a page orientation. If specified,ok
will be set toTrue
if string could be successfully interpreted as a page orientation.- Parameters:
string (Optional[str]) -> (QgsLayoutItemPage.Orientation)
- orientation(self) QgsLayoutItemPage.Orientation [source]¶
Returns the page orientation.
Note
There is no direct setter for page orientation - use
setPageSize()
instead.- Return type:
- pageLayout(self) QPageLayout [source]¶
Returns the page layout for the page, suitable to pass to QPrinter.setPageLayout
Added in version 3.20.
- Return type:
QPageLayout
- pageSize(self) QgsLayoutSize [source]¶
Returns the size of the page.
See also
- Return type:
- pageStyleSymbol(self) QgsFillSymbol | None [source]¶
Returns the symbol to use for drawing the page background.
See also
Added in version 3.10.
- Return type:
Optional[QgsFillSymbol]
- setPageSize(self, size: QgsLayoutSize)[source]¶
Sets the
size
of the page.See also
- Parameters:
size (
QgsLayoutSize
)
- setPageSize(self, size: str | None, orientation: QgsLayoutItemPage.Orientation = QgsLayoutItemPage.Portrait) bool [source]
Sets the page size to a known page
size
, e.g. “A4” andorientation
. The known page sizes are managed byQgsPageSizeRegistry
. Valid page sizes can be retrieved viaQgsPageSizeRegistry.entries()
. The function returnsTrue
ifsize
was a valid page size and the page size was changed. IfFalse
is returned thensize
could not be matched to a known page size.See also
- Parameters:
size (Optional[str])
orientation (QgsLayoutItemPage.Orientation = QgsLayoutItemPage.Portrait)
- Return type:
bool
- setPageStyleSymbol(self, symbol: QgsFillSymbol | None)[source]¶
Sets the
symbol
to use for drawing the page background.Ownership of
symbol
is transferred to the page.See also
Added in version 3.10.
- Parameters:
symbol (Optional[QgsFillSymbol])