Class: QgsAbstractLayoutUndoCommand¶
- class qgis.core.QgsAbstractLayoutUndoCommand(text: str, id: int = 0, parent: QUndoCommand = None)¶
Bases:
PyQt5.QtWidgets.QUndoCommand
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.Base class for commands to undo/redo layout and layout object changes.
New in version 3.0:
Methods
Returns the after state for the layout.
Returns the before state for the layout.
Returns
True
if both the before and after states are valid and different.- rtype
int
Restores the state of the object from the specified
stateDoc
.Saves current layout state as after state.
Saves current layout state as before state.
Saves the state of the object to the specified
stateDoc
.Manually sets the after state for the command.
- afterState(self) QDomDocument ¶
Returns the after state for the layout.
See also
See also
- Return type
QDomDocument
- beforeState(self) QDomDocument ¶
Returns the before state for the layout.
See also
See also
- Return type
QDomDocument
- containsChange(self) bool ¶
Returns
True
if both the before and after states are valid and different.- Return type
bool
- id(self) int ¶
- Return type
int
- redo(self)¶
- restoreState(self, stateDoc: QDomDocument)¶
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) –
- saveAfterState(self)¶
Saves current layout state as after state.
See also
See also
- saveBeforeState(self)¶
Saves current layout state as before state.
See also
See also
- saveState(self, stateDoc: QDomDocument)¶
Saves the state of the object to the specified
stateDoc
.Subclasses must implement this to handle encapsulating their current state into a DOM document.
See also
- Parameters
stateDoc (QDomDocument) –
- setAfterState(self, stateDoc: QDomDocument)¶
Manually sets the after state for the command. Generally this should not be called directly.
- Parameters
stateDoc (QDomDocument) –
- undo(self)¶