Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-1256

Extend the Undo/Redo framework to handle failing commands

XMLWordPrintable

    • Icon: Suggestion Suggestion
    • Resolution: Out of scope
    • Icon: P3: Somewhat important P3: Somewhat important
    • Some future release
    • 4.3.2
    • Other
    • None

      Here is the scenario:

      Implement Undo/Redo for a database.
      Imagine a Command called "InsertRow".

      At the moment, if the redo() function of this command fails, there is no elegant way of supporting this. It still gets added to the UndoStack. A workaround is to have an internal flag in the command itself so that when the undo() is called for this command it will basically resolve into a NOP, but it's still in the stack.

      One proper solution could be to let the void redo() function return a bool instead, and if this bool is false the UndoStack will not add it to the stack but actually delete it. (This would all happen in the push(...) function of the UndoStack).

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            bdo Jo Asplin (Inactive)
            riskedal Espen Riskedal (closed Nokia identity) (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes