Details
-
Suggestion
-
Resolution: Unresolved
-
P4: Low
-
4.7.1
-
None
Description
It will be nice to have deleteUndone() (or something like this) method in QUndoStack that'll delete all commands, that are undone there.
Example of usage:
I have a model that uses Undo framework for all actions.
To create new item in this model, user clicks a button. This button causes creation of new item and opens dialogue, where user can change properties of newly created item. Properties are changing using QDataWidgetMapper in this dialogue.
Meanwhile, following happens in Undo stack:
- Start macro.
- Push CreateItemCommand.
- Push EditItemPropertyCommand.
- Push EditItemPropertyCommand.
- Push EditItemPropertyCommand.
- ...
- End macro.
If user presses Ok in dialogue, newly created item just stays there.
But in case of Cancel... uh... currently, redo() happens. And that stupid unneeded undo command stays in stack. Therefore, it will be nice to have deleteUndone() method, that will delete this thing.
By the way, there was a way to do same thing in past — http://doc.trolltech.com/qq/qq25-undo.html contains following code:
if(!m_cachedResult) delete m_stack->command(0);
Now this causes to segfault.
This suggested is like QTBUG-7096 somehow, but is much easier to do.
Sorry for bad English.
Attachments
Issue Links
- relates to
-
QTBUG-40380 QUndoStack: Remove "empty" commands from the undo stack that might occur after mergeWith()
-
- Open
-