QUndoStack with dropdown
-
Hi,
I want to implement a undo button that shows a list of undo actions to choose from. For example, like in Microsoft Office where I can choose from a list of actions. I can directly jump to the past 10th action instead of clicking undo button 10 times.
In the Qt tutorial, only QUndoView usage with an external window.Any idea I can do a similar thing without an extra window but with a dropdown?
Any examples that someone can point me to? -
@vijaychsk There is nothing that can stop you, I think. I never did it myself but I think it is entirely doable - you just add actions descriptions and index to the combo box and then push them to the stack. To get the action back you use that stored index. Grouping would also need to be implemented.
So, in theory, you'd just need to reimplement undo view using the stack as a store for undo actions. -
Hi,
You would need to implement your own model to set on the QComboBox. The one used by QUndoView is implemented beside the class implementation.
-
@SGaist said in QUndoStack with dropdown:
You would need to implement your own model to set on the QComboBox.
@vijaychsk
Given what @SGaist is pointing it out here, you would have to write some code to replicate the functionality. Using your button to icon to "pop up" aQUndoView
in some shape or form sounds like less work than utilising aQComboBox
. You might want to bear that in mind.