Class: QgsLayoutSerializableObject

An interface for layout objects which can be stored and read from DOM elements.

Class Hierarchy

Inheritance diagram of qgis.core.QgsLayoutSerializableObject

Base classes

QgsLayoutUndoObjectInterface

Interface for layout objects which support undo/redo commands.

Subclasses

QgsLayoutAtlas

Class used to render QgsLayout as an atlas, by iterating over the features from an associated vector layer.

QgsLayoutGridSettings

Contains settings relating to the appearance, spacing and offset for layout grids.

QgsLayoutGuideCollection

Stores and manages the snap guides used by a layout.

QgsLayoutPageCollection

A manager for a collection of pages in a layout.

QgsLayoutSnapper

Manages snapping grids and preset snap lines in a layout, and handles snapping points to the nearest grid coordinate/snap line when possible.

Methods

layout

Returns the layout the object belongs to.

readXml

Sets the objects's state from a DOM element.

stringType

Returns the object type as a string.

writeXml

Stores the objects's state in a DOM element.

class qgis.core.QgsLayoutSerializableObject[source]

Bases: QgsLayoutUndoObjectInterface

layout(self) QgsLayout | None[source]

Returns the layout the object belongs to.

Return type:

Optional[QgsLayout]

readXml(self, element: QDomElement, document: QDomDocument, context: QgsReadWriteContext) bool[source]

Sets the objects’s state from a DOM element. element is the DOM node corresponding to the object.

See also

writeXml()

Parameters:
Return type:

bool

stringType(self) str[source]

Returns the object type as a string.

This string must be a unique, single word, character only representation of the item type, eg “LayoutScaleBar”

Return type:

str

writeXml(self, parentElement: QDomElement, document: QDomDocument, context: QgsReadWriteContext) bool[source]

Stores the objects’s state in a DOM element. The parentElement should refer to the parent layout’s DOM element.

See also

readXml()

Parameters:
Return type:

bool