#include <mlUndoContextWrapper.h>
Inherits MLRefCountedBaseWrapper.
|
static ml::RefCountedBase * | createObject (const QVariantList &arguments) |
|
A class that wraps UndoContext objects for use in Python.
◆ addUndoStep
bool MLUndoContextWrapper::addUndoStep |
( |
PythonQtObjectPtr | step | ) |
|
|
slot |
Add Python object as an undo step.
This object needs to have the following properties:
undo - Must be a callable that performs the undo step.
redo - Must be a callable that performs the redo step.
description - Must be a callable that returns the description or else the description itself; if the description is not a string, repr() is called on the value.
owner (optional) - The object that should be considered as the owner of this undo step. This can be used to remove all undo steps of that owner at once with removeAllUndoStepsOfOwner.
dispose (optional) - A callable that is called when the undo step is removed from the undo context.
If the given object does not meet the requirements, no undo step is added and False is returned.
◆ clear
void MLUndoContextWrapper::clear |
( |
| ) |
|
|
slot |
Clears the undo/redo stack.
◆ clearRedoSteps
void MLUndoContextWrapper::clearRedoSteps |
( |
| ) |
|
|
slot |
◆ closeUndoGroup
void MLUndoContextWrapper::closeUndoGroup |
( |
| ) |
|
|
slot |
Finishes grouping started with openUndoGroup.
◆ createObject()
static ml::RefCountedBase * MLUndoContextWrapper::createObject |
( |
const QVariantList & | arguments | ) |
|
|
static |
Creates a new UndoContext. No arguments need to be provided.
◆ duringRedo
bool MLUndoContextWrapper::duringRedo |
( |
| ) |
|
|
slot |
Returns true
while an redo operation is performed.
◆ duringUndo
bool MLUndoContextWrapper::duringUndo |
( |
| ) |
|
|
slot |
Returns true
while an undo operation is performed.
◆ duringUndoOrRedo
bool MLUndoContextWrapper::duringUndoOrRedo |
( |
| ) |
|
|
slot |
Returns true
while an undo or redo operation is performed.
◆ getAllRedoDescriptions
QStringList MLUndoContextWrapper::getAllRedoDescriptions |
( |
| ) |
const |
|
slot |
Returns the description of the all available redo steps, with the next redo step first.
◆ getAllUndoDescriptions
QStringList MLUndoContextWrapper::getAllUndoDescriptions |
( |
| ) |
const |
|
slot |
Returns the description of the all available undo steps, with the next undo step first.
◆ getRedoDescription
QString MLUndoContextWrapper::getRedoDescription |
( |
| ) |
const |
|
slot |
Returns a description of the next redo step (or an empty string of no redo step is available).
◆ getUndoDescription
QString MLUndoContextWrapper::getUndoDescription |
( |
| ) |
const |
|
slot |
Returns a description of the next undo step (or an empty string of no undo step is available).
◆ numRedoSteps
int MLUndoContextWrapper::numRedoSteps |
( |
| ) |
const |
|
slot |
Returns the number of available redo steps.
◆ numUndoSteps
int MLUndoContextWrapper::numUndoSteps |
( |
| ) |
const |
|
slot |
Returns the number of available undo steps.
◆ openUndoGroup
void MLUndoContextWrapper::openUndoGroup |
( |
const QString & | description | ) |
|
|
slot |
Opens an undo group; all subsequent performed steps that generate an undo step will grouped and appear under the given description.
closeUndoGroup must be called to finish the grouping. Nesting of calls is allowed.
◆ redo
bool MLUndoContextWrapper::redo |
( |
| ) |
|
|
slot |
Performs redo, returns false
if there was no UndoStep to execute.
◆ removeAllUndoStepsOfOwner
bool MLUndoContextWrapper::removeAllUndoStepsOfOwner |
( |
PythonQtObjectPtr | owner | ) |
|
|
slot |
Removes all undo steps that have the given owner.
Returns True if any step was removed at all.
◆ removeUndoStep
void MLUndoContextWrapper::removeUndoStep |
( |
PythonQtObjectPtr | step | ) |
|
|
slot |
Removes UndoStep, also removes all undo operations beyond this operation; if the step belongs to an undo group, the entire group is deleted.
It is expected that users most of the time rather use removeAllUndoStepsOfOwner.
◆ setUndoLimit
void MLUndoContextWrapper::setUndoLimit |
( |
int | limit | ) |
|
|
slot |
Sets the maximum number of undo/redo steps to retain.
-1 means unlimited. Setting this will remove excess steps (undo steps first).
◆ stateChanged
void MLUndoContextWrapper::stateChanged |
( |
| ) |
|
|
signal |
Emitted if the state of the UndoContext changes (undo/redo steps have been added or removed).
◆ undo
bool MLUndoContextWrapper::undo |
( |
| ) |
|
|
slot |
Performs undo, returns false
if there was no UndoStep to execute.
◆ undoLimit
int MLUndoContextWrapper::undoLimit |
( |
| ) |
const |
|
slot |
Returns the maximum number of undo/redo steps that are retained. -1 means unlimited.