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.

Parameters
  • text (str) –

  • id (int = 0) –

  • parent

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)