Class: QgsAbstractLayoutUndoCommand

class qgis.core.QgsAbstractLayoutUndoCommand(text: str, id: int = 0, parent: QUndoCommand = None)

Bases: PyQt5.QtWidgets.QUndoCommand

Constructor for QgsLayoutUndoCommand. The id 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

afterState Returns the after state for the layout.
beforeState Returns the before state for the layout.
containsChange Returns true if both the before and after states are valid and different.
id
redo
restoreState Restores the state of the object from the specified stateDoc.
saveAfterState Saves current layout state as after state.
saveBeforeState Saves current layout state as before state.
saveState Saves the state of the object to the specified stateDoc.
setAfterState Manually sets the after state for the command.
undo

Signals

Attributes

afterState(self) → QDomDocument

Returns the after state for the layout.

See also

saveAfterState()

See also

beforeState()

beforeState(self) → QDomDocument

Returns the before state for the layout.

See also

afterState()

containsChange(self) → bool

Returns true if both the before and after states are valid and different.

id(self) → 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

saveState()

saveAfterState(self)

Saves current layout state as after state.

See also

afterState()

saveBeforeState(self)

Saves current layout state as before state.

See also

beforeState()

See also

saveAfterState()

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

restoreState()

setAfterState(self, stateDoc: QDomDocument)

Manually sets the after state for the command. Generally this should not be called directly.

undo(self)