Class: QgsLayoutSerializableObject¶
- class qgis.core.QgsLayoutSerializableObject¶
Bases:
QgsLayoutUndoObjectInterface
An interface for layout objects which can be stored and read from DOM elements.
Methods
- param text:
Returns the layout the object belongs to.
Sets the objects's state from a DOM element.
Returns the object type as a string.
Stores the objects's state in a DOM element.
- createCommand(self, text: str | None, id: int, parent: QUndoCommand | None = None) QgsAbstractLayoutUndoCommand | None ¶
- Parameters:
text (Optional[str])
id (int)
parent (Optional[QUndoCommand] = None)
- Return type:
Optional[QgsAbstractLayoutUndoCommand]
- layout(self) QgsLayout | None ¶
Returns the layout the object belongs to.
- Return type:
Optional[QgsLayout]
- readXml(self, element: QDomElement, document: QDomDocument, context: QgsReadWriteContext) bool ¶
Sets the objects’s state from a DOM element.
element
is the DOM node corresponding to the object.See also
- Parameters:
element (QDomElement)
document (QDomDocument)
context (QgsReadWriteContext)
- Return type:
bool
- stringType(self) str ¶
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 ¶
Stores the objects’s state in a DOM element. The
parentElement
should refer to the parent layout’s DOM element.See also
- Parameters:
parentElement (QDomElement)
document (QDomDocument)
context (QgsReadWriteContext)
- Return type:
bool