Subgroup: Layout

Class: QgsLayoutUndoStack

class qgis.core.QgsLayoutUndoStack

Bases: PyQt5.QtCore.QObject

An undo stack for QgsLayouts.

New in version 3.0: Methods

beginCommand Begins a new undo command for the specified object.
beginMacro Starts a macro command, with the given descriptive commandText.
blockCommands Sets whether undo commands for the layout should be temporarily blocked.
blockSignals
cancelCommand Cancels the active command, discarding it without pushing to the undo history.
childEvent
children
connectNotify
customEvent
deleteLater
disconnect
disconnectNotify
dumpObjectInfo
dumpObjectTree
dynamicPropertyNames
endCommand Saves final state of an object and pushes the active command to the undo history.
endMacro Ends a macro command.
event
eventFilter
findChild findChild(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> QObject
findChildren findChildren(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject]
inherits
installEventFilter
isBlocked Returns true if undo commands are currently blocked.
isSignalConnected
isWidgetType
isWindowType
killTimer
metaObject
moveToThread
notifyUndoRedoOccurred Notifies the stack that an undo or redo action occurred for a specified item.
objectName
parent
property
push Manually pushes a command to the stack, and takes ownership of the command.
pyqtConfigure Each keyword argument is either the name of a Qt property or a Qt signal.
receivers
removeEventFilter
sender
senderSignalIndex
setObjectName
setParent
setProperty
signalsBlocked
stack Returns a pointer to the internal QUndoStack.
startTimer
thread
timerEvent
tr

Attributes

destroyed destroyed(self, QObject = None) [signal]
objectNameChanged objectNameChanged(self, str) [signal]
staticMetaObject
beginCommand(self, object: QgsLayoutUndoObjectInterface, commandText: str, id: int = 0)

Begins a new undo command for the specified object.

This must be followed by a call to endCommand() or cancelCommand() after the desired changes have been made to object.

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.

See also

endCommand()

See also

cancelCommand()

beginMacro(self, commandText: str)

Starts a macro command, with the given descriptive commandText.

Any commands added to the stack (either via direct manipulation of stack() or via beginCommand()/endCommand() calls) between a beginMacro() and endMacro() block are collapsed into a single undo command, which will be applied or rolled back in a single step.

See also

endMacro()

blockCommands(self, blocked: bool)

Sets whether undo commands for the layout should be temporarily blocked.

If blocked is true, subsequent undo commands will be blocked until a follow-up call to blockCommands( false ) is made.

Note that calls to blockCommands are stacked, so two calls blocking the commands will take two calls unblocking commands in order to release the block.

See also

isBlocked()

cancelCommand(self)

Cancels the active command, discarding it without pushing to the undo history.

See also

endCommand()

See also

cancelCommand()

childEvent()
connectNotify()
customEvent()
disconnectNotify()
endCommand(self)

Saves final state of an object and pushes the active command to the undo history.

See also

beginCommand()

See also

cancelCommand()

endMacro(self)

Ends a macro command. This must be called after beginMacro(), when all child undo commands which form part of the macro have been completed.

Any commands added to the stack (either via direct manipulation of stack() or via beginCommand()/endCommand() calls) between a beginMacro() and endMacro() block are collapsed into a single undo command, which will be applied or rolled back in a single step.

See also

beginMacro()

isBlocked(self) → bool

Returns true if undo commands are currently blocked.

See also

blockCommands()

isSignalConnected()
notifyUndoRedoOccurred(self, item: QgsLayoutItem)

Notifies the stack that an undo or redo action occurred for a specified item.

push(self, command: QUndoCommand)

Manually pushes a command to the stack, and takes ownership of the command.

receivers()
sender()
senderSignalIndex()
stack(self) → QUndoStack

Returns a pointer to the internal QUndoStack.

timerEvent()