Closed AriaSalvatrice closed 4 years ago
Pushing back that one for later. Anyone knows of open-source modules that implemented this so I can see what they did?
Adding an Action to the APP-history. However, this example uses anonymous functions, because I prefer them. The EventWidgetAction is defined here and here
If you don't want to be doing anonymous functions, you need a subclass of ModuleAction for each kind of undo that you need, create an instance of your subclass, give it whatever information it needs to undo / redo the action, and then add it to the APP->history.
Don't put a pointer to your module into the action, set the moduleId in the action instead, and then the undo/redo methods should find that module by it's id. That's because your undo might get called after someone has deleted your module and then undone the delete, so your pointer would be invalid, but the id should be good.
Undo support was added to the development branch. Thank you for the example implementation @david-c14 !
Haven't looked into how to implement it yet