MeVisLab Scripting Reference
MLUndoContextWrapper Class Reference

Inherits MLRefCountedBaseWrapper.

Public Slots

bool addUndoStep (PythonQtObjectPtr step)
 
void clear ()
 
void clearRedoSteps ()
 
void closeUndoGroup ()
 
bool duringRedo ()
 
bool duringUndo ()
 
bool duringUndoOrRedo ()
 
QStringList getAllRedoDescriptions () const
 
QStringList getAllUndoDescriptions () const
 
QString getRedoDescription () const
 
QString getUndoDescription () const
 
int numRedoSteps () const
 
int numUndoSteps () const
 
void openUndoGroup (const QString &description)
 
bool redo ()
 
bool removeAllUndoStepsOfOwner (PythonQtObjectPtr owner)
 
void removeUndoStep (PythonQtObjectPtr step)
 
void setUndoLimit (int limit)
 
bool undo ()
 
int undoLimit () const
 

Signals

void stateChanged ()
 

Static Public Member Functions

static ml::RefCountedBase * createObject (const QVariantList &arguments)
 

Detailed Description

A class that wraps UndoContext objects for use in Python.

Member Function Documentation

◆ addUndoStep

bool MLUndoContextWrapper::addUndoStep ( PythonQtObjectPtr  step)
slot

Add Python object as 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 doesn't meet the requirements, no undo step is added and False is returned.

◆ clear

void MLUndoContextWrapper::clear ( )
slot

Clear the undo/redo stack.

◆ clearRedoSteps

void MLUndoContextWrapper::clearRedoSteps ( )
slot

Clear all redo steps.

◆ closeUndoGroup

void MLUndoContextWrapper::closeUndoGroup ( )
slot

Finish grouping started with openUndoGroup.

◆ createObject()

static ml::RefCountedBase* MLUndoContextWrapper::createObject ( const QVariantList &  arguments)
static

Create 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 description of next redo step (or an empty string of no redo step is available)

◆ getUndoDescription

QString MLUndoContextWrapper::getUndoDescription ( ) const
slot

Returns description of next undo step (or an empty string of no undo step is available)

◆ numRedoSteps

int MLUndoContextWrapper::numRedoSteps ( ) const
slot

Returns number of available redo steps.

◆ numUndoSteps

int MLUndoContextWrapper::numUndoSteps ( ) const
slot

Returns number of available undo steps.

◆ openUndoGroup

void MLUndoContextWrapper::openUndoGroup ( const QString &  description)
slot

Open an undo group; all subsequent performed steps which 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

Perform redo, returns false if there was no UndoStep to execute.

◆ removeAllUndoStepsOfOwner

bool MLUndoContextWrapper::removeAllUndoStepsOfOwner ( PythonQtObjectPtr  owner)
slot

Remove all undo steps that have the given owner.

Returns True if any step was removed at all.

◆ removeUndoStep

void MLUndoContextWrapper::removeUndoStep ( PythonQtObjectPtr  step)
slot

Remove UndoStep, also removes all undo operations beyond this operation; if the step belongs to an undo group, the whole group is deleted.

It is expected that users most of the time rather use removeAllUndoStepsOfOwner.

◆ setUndoLimit

void MLUndoContextWrapper::setUndoLimit ( int  limit)
slot

Set 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

Perform undo, returns false if there was no UndoStep to execute.

◆ undoLimit

int MLUndoContextWrapper::undoLimit ( ) const
slot

Get the maximum number of undo/redo steps that are retained. -1 means unlimited.