Class: QgsAbstractLayoutUndoCommand

class qgis.core.QgsAbstractLayoutUndoCommand

Bases: PyQt5.QtWidgets.QUndoCommand

Base class for commands to undo/redo layout and layout object changes.

QgsAbstractLayoutUndoCommand(text: str, id: int = 0, parent: QUndoCommand = None) 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.

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

rtype:

int

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

afterState(self) QDomDocument

Returns the after state for the layout.

See also

saveAfterState()

See also

beforeState()

Return type:

QDomDocument

beforeState(self) QDomDocument

Returns the before state for the layout.

See also

afterState()

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

saveState()

Parameters:

stateDoc (QDomDocument) –

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()

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)