User Tools

Site Tools


DzUndoStack

The application undo stack.

More...

Inherits :

Methods

Signals

voidredoAvailable ( Boolean yesNo )
voidredoCaptionChanged ( String caption )
voidundoAvailable ( Boolean yesNo )
voidundoCaptionChanged ( String caption )

Detailed Description

There is only one undo stack in the application, which is created and owned by DzApp. This object is directly available using the Global::UndoStack variable.

Methods


void : accept( String caption )

It is recommended that you use Global::acceptUndo() instead of calling this function directly to avoid leaving the undo stack open.

Finishes the hold and pushes the undo list onto the stack. If the stack is already at maximum depth, it pushes the oldest item off of the list.

Parameter(s):

  • caption - A descriptive string to display for the undo list.

void : beginHold()

It is recommended that you use Global::beginUndo() instead of calling this function directly to avoid leaving the undo stack open.

Begins a hold, collecting all undo items into one undo entry. Every call to begin hold must be matched by a call to accept() or cancel().


void : cancel()

It is recommended that you use Global::cancelUndo() instead of calling this function directly to avoid leaving the undo stack open.

Finishes the hold but immediately calls undo to restore the state of the list to what it was before the matching beginHold() call.


Boolean : canPushItems()

Return Value:

  • true if undo items can be pushed onto the stack, otherwise false.

Boolean : canRedo()

Return Value:

  • true if redo() can be called, otherwise false.

Boolean : canUndo()

Return Value:

  • true if undo() can be called, otherwise false.

void : clearAll()

Clears the undo stack. This must be called at least whenever the list changes.

See Also:


void : drop()

It is recommended that you use Global::dropUndo() instead of calling this function directly to avoid leaving the undo stack open.

Accepts the actions performed and closes the undo stack hold without adding the items to the undo stack - the memory associated with the items is freed.


String : getCaption( Number offset=0 )

Parameter(s):

  • offset - The number of positions from the current position.

Return Value:

  • If getCurrentIndex() + offset is within the [0, getNumItems() - 1] range, the caption assigned to the item at the index, otherwise an empty string.

Since:

  • 4.9.3.61

Number : getCurrentIndex()

Return Value:

  • The index of the current position in the stack.

Attention:

  • Each time an item is added or removed from the stack, each time undo() or redo() is called, each time accept() or clearAll() is called, the current index is changed.

Since:

  • 4.9.3.61

Number : getNumItems()

Return Value:

  • The total number of items in the undo stack.

Number : getNumRedoItems()

Return Value:

  • The total number of list items on the redo stack.

Number : getNumUndoItems()

Return Value:

  • The total number of list items on the undo stack.

String : getRedoCaption()

Return Value:

  • The caption assigned to the redo item at the top of the stack.

String : getUndoCaption()

Return Value:

  • The caption assigned to the undo item at the top of the stack.

Boolean : hasItems()

Return Value:

  • true if there are items on the undo stack, otherwise false.

Boolean : isInUndoRedo()

Return Value:

  • true if the undo stack is currently engaged in an undo/redo operation. This is useful for items that need to perform certain operations if the undo stack is not the one effecting data changes.

void : lock()

Disables items from being pushed onto the stack. This will be toggled by items to prevent undo operations from creating new undo items during an undo. Every call to lock() must be matched by a call to unlock().


Boolean : redo()

Calls redo on the item at the top of the stack, then moves the pointer to the next item in the stack.

Return Value:

  • true on success, false on error or if the stack is empty.

Boolean : undo()

Calls undo on the item at the top of the stack, then moves the pointer to the previous item in the stack.

Return Value:

  • true if successful, false on error or if the stack is empty.

void : unlock()

Enables items to be pushed onto the stack after a lock() call.

Signals


void : redoAvailable( Boolean yesNo )

Signature:“redoAvailable(bool)”

Emitted when the availability of the redo stack changes.


void : redoCaptionChanged( String caption )

Signature:“redoCaptionChanged(const QString&)”

Emitted when the caption of the redo stack changes.


void : undoAvailable( Boolean yesNo )

Signature:“undoAvailable(bool)”

Emitted when the availability of the undo stack changes.


void : undoCaptionChanged( String caption )

Signature:“undoCaptionChanged(const QString&)”

Emitted when the caption of the undo stack changes.