Details
-
Suggestion
-
Resolution: Out of scope
-
P4: Low
-
4.3.1
-
None
Description
One use-case for QUndoStack is that each QUndoCommand corresponds to a SQL update-statement; in this case, it would be good if a list of undo-operations would be handled as a transaction - the transaction starts when setIndex is called, and is commited when setIndex is done. This is right now difficult to implement, as setIndex is not virtual (but is called by QUndoView), and QUndoCommand::undo/redo don't return a bool.
The only point where this can be implemented right now is QUndoCommand::undo/redo, which however doesn't know enough about the context in which they are invoked (i.e. as part of a single undo-operation, or of a chain of undos). This requires the use of static variables and 0-timer based commits, which is not very clean. A virtual QUndoStack::setIndex would simplify this.