Class: QgsAbstractLayoutUndoCommand¶
Base class for commands to undo/redo layout and layout object changes.
Note
This is an abstract class, with methods which must be implemented by a subclass.
The following methods must be implemented: restoreState()
, saveState()
Class Hierarchy¶
Base classes¶
Abstract Methods
Restores the state of the object from the specified stateDoc. |
|
Saves the state of the object to the specified stateDoc. |
Methods
Returns the after state for the layout. |
|
Returns the before state for the layout. |
|
Saves current layout state as after state. |
|
Saves current layout state as before state. |
|
Manually sets the after state for the command. |
Virtual Methods
In PyQGIS, only methods marked as virtual
can be safely overridden in a Python subclass of QgsAbstractLayoutUndoCommand. See the FAQ for more details.
Returns |
- class qgis.core.QgsAbstractLayoutUndoCommand[source]¶
Bases:
QUndoCommand
- __init__(text: str | None, id: int = 0, parent: QUndoCommand | None = None)
Constructor for
QgsLayoutUndoCommand
. Theid
argument can be used to specify an id number for the source event - this is used to determine whether QUndoCommand command compression can apply to the command.- Parameters:
text (Optional[str])
id (int = 0)
parent (Optional[QUndoCommand] = None)
- afterState(self) QDomDocument [source]¶
Returns the after state for the layout.
See also
See also
- Return type:
QDomDocument
- beforeState(self) QDomDocument [source]¶
Returns the before state for the layout.
See also
See also
- Return type:
QDomDocument
- virtual containsChange(self) bool [source]¶
Returns
True
if both the before and after states are valid and different.- Return type:
bool
- abstract restoreState(self, stateDoc: QDomDocument)[source]¶
Restores the state of the object from the specified
stateDoc
.Subclasses must implement this to handle restoring their current state from the encapsulated state.
See also
- Parameters:
stateDoc (QDomDocument)