Class: QgsLayoutItemPage

class qgis.core.QgsLayoutItemPage

Bases: QgsLayoutItem

Item representing the paper in a layout.

New in version 3.0.

QgsLayoutItemPage(layout: QgsLayout) Constructor for QgsLayoutItemPage, with the specified parent layout.

Methods

accept

param visitor

attemptResize

param size

boundingRect

rtype

QRectF

childEvent

connectNotify

contextMenuEvent

create

Returns a new page item for the specified layout.

createCommand

param text

customEvent

decodePageOrientation

Decodes a string representing a page orientation.

disconnectNotify

displayName

rtype

str

dragEnterEvent

dragLeaveEvent

dragMoveEvent

draw

param context

drawBackground

param context

drawFrame

param context

dropEvent

exportLayerBehavior

rtype

QgsLayoutItem.ExportLayerBehavior

focusInEvent

focusOutEvent

hoverEnterEvent

hoverLeaveEvent

hoverMoveEvent

inputMethodEvent

inputMethodQuery

isSignalConnected

itemChange

keyPressEvent

keyReleaseEvent

mouseDoubleClickEvent

mouseMoveEvent

mousePressEvent

mouseReleaseEvent

orientation

Returns the page orientation.

pageLayout

Returns the page layout for the page, suitable to pass to QPrinter.setPageLayout

pageSize

Returns the size of the page.

pageStyleSymbol

Returns the symbol to use for drawing the page background.

prepareGeometryChange

readPropertiesFromElement

param itemElement

receivers

redraw

sceneEvent

sceneEventFilter

sender

senderSignalIndex

setPageSize

Sets the size of the page.

setPageStyleSymbol

Sets the symbol to use for drawing the page background.

timerEvent

type

rtype

int

updateMicroFocus

wheelEvent

writePropertiesToElement

param parentElement

Attributes

Landscape

Portrait

UndoPageSymbol

Landscape = 1
class Orientation

Bases: int

Portrait = 0
class UndoCommand

Bases: int

UndoPageSymbol = 3000
accept(self, visitor: QgsStyleEntityVisitorInterface) bool
Parameters

visitor (QgsStyleEntityVisitorInterface) –

Return type

bool

attemptResize(self, size: QgsLayoutSize, includesFrame: bool = False)
Parameters
boundingRect(self) QRectF
Return type

QRectF

childEvent(self, QChildEvent)
connectNotify(self, QMetaMethod)
contextMenuEvent(self, QGraphicsSceneContextMenuEvent)
create(layout: QgsLayout) QgsLayoutItemPage

Returns a new page item for the specified layout.

The caller takes responsibility for deleting the returned object.

Parameters

layout (QgsLayout) –

Return type

QgsLayoutItemPage

createCommand(self, text: str, id: int, parent: QUndoCommand = None) QgsAbstractLayoutUndoCommand
Parameters
  • text (str) –

  • id (int) –

  • parent (QUndoCommand = None) –

Return type

QgsAbstractLayoutUndoCommand

customEvent(self, QEvent)
decodePageOrientation(string: str) Tuple[QgsLayoutItemPage.Orientation, bool]

Decodes a string representing a page orientation. If specified, ok will be set to True if string could be successfully interpreted as a page orientation.

Parameters

string (str) –

Return type

Tuple[QgsLayoutItemPage.Orientation, bool]

disconnectNotify(self, QMetaMethod)
displayName(self) str
Return type

str

dragEnterEvent(self, QGraphicsSceneDragDropEvent)
dragLeaveEvent(self, QGraphicsSceneDragDropEvent)
dragMoveEvent(self, QGraphicsSceneDragDropEvent)
draw(self, context: QgsLayoutItemRenderContext)
Parameters

context (QgsLayoutItemRenderContext) –

drawBackground(self, context: QgsRenderContext)
Parameters

context (QgsRenderContext) –

drawFrame(self, context: QgsRenderContext)
Parameters

context (QgsRenderContext) –

dropEvent(self, QGraphicsSceneDragDropEvent)
exportLayerBehavior(self) QgsLayoutItem.ExportLayerBehavior
Return type

QgsLayoutItem.ExportLayerBehavior

focusInEvent(self, QFocusEvent)
focusOutEvent(self, QFocusEvent)
hoverEnterEvent(self, QGraphicsSceneHoverEvent)
hoverLeaveEvent(self, QGraphicsSceneHoverEvent)
hoverMoveEvent(self, QGraphicsSceneHoverEvent)
inputMethodEvent(self, QInputMethodEvent)
inputMethodQuery(self, Qt.InputMethodQuery) Any
isSignalConnected(self, QMetaMethod) bool
itemChange(self, QGraphicsItem.GraphicsItemChange, Any) Any
keyPressEvent(self, QKeyEvent)
keyReleaseEvent(self, QKeyEvent)
mouseDoubleClickEvent(self, QGraphicsSceneMouseEvent)
mouseMoveEvent(self, QGraphicsSceneMouseEvent)
mousePressEvent(self, QGraphicsSceneMouseEvent)
mouseReleaseEvent(self, QGraphicsSceneMouseEvent)
orientation(self) QgsLayoutItemPage.Orientation

Returns the page orientation.

Note

There is no direct setter for page orientation - use setPageSize() instead.

Return type

QgsLayoutItemPage.Orientation

pageLayout(self) QPageLayout

Returns the page layout for the page, suitable to pass to QPrinter.setPageLayout

New in version 3.20.

Return type

QPageLayout

pageSize(self) QgsLayoutSize

Returns the size of the page.

See also

setPageSize()

Return type

QgsLayoutSize

pageStyleSymbol(self) QgsFillSymbol

Returns the symbol to use for drawing the page background.

New in version 3.10.

Return type

QgsFillSymbol

prepareGeometryChange(self)
readPropertiesFromElement(self, itemElement: QDomElement, document: QDomDocument, context: QgsReadWriteContext) bool
Parameters
Return type

bool

receivers(self, PYQT_SIGNAL) int
redraw(self)
sceneEvent(self, QEvent) bool
sceneEventFilter(self, QGraphicsItem, QEvent) bool
sender(self) QObject
senderSignalIndex(self) int
setPageSize(self, size: QgsLayoutSize)

Sets the size of the page.

See also

pageSize()

setPageSize(self, size: str, orientation: QgsLayoutItemPage.Orientation = QgsLayoutItemPage.Portrait) -> bool Sets the page size to a known page size, e.g. “A4” and orientation. The known page sizes are managed by QgsPageSizeRegistry. Valid page sizes can be retrieved via QgsPageSizeRegistry.entries(). The function returns True if size was a valid page size and the page size was changed. If False is returned then size could not be matched to a known page size.

See also

pageSize()

Parameters

size (QgsLayoutSize) –

setPageStyleSymbol(self, symbol: QgsFillSymbol)

Sets the symbol to use for drawing the page background.

Ownership of symbol is transferred to the page.

New in version 3.10.

Parameters

symbol (QgsFillSymbol) –

timerEvent(self, QTimerEvent)
type(self) int
Return type

int

updateMicroFocus(self)
wheelEvent(self, QGraphicsSceneWheelEvent)
writePropertiesToElement(self, parentElement: QDomElement, document: QDomDocument, context: QgsReadWriteContext) bool
Parameters
  • parentElement (QDomElement) –

  • document (QDomDocument) –

  • context (QgsReadWriteContext) –

Return type

bool