Details
-
Suggestion
-
Resolution: Out of scope
-
P3: Somewhat important
-
4.3.2
-
None
Description
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).
Attachments
Issue Links
- is replaced by
-
QTBUG-7096 CLONE -Extend the Undo/Redo framework to handle failing commands
-
- Open
-