My program consists of multiple QLineEdit
\'s in my QMainWindow
. The user can change the text in any QLineEdit
. Currently I can perform
Qt provides an Undo/Redo framework.
You basically implement a command, derived from QUndoCommand, for each of the actions you want to make undoable/redoable, and then push them to a QUndoStack. Later, the commands can be undone and redone by calling the corresponding slots on the QUndoStack
.
Note that, when pushing a command on the stack, it is automatically redone, means executed for the first time. Sometimes this is not what you want, since the command might actually already have been executed - you would need to consider this in the implementation of your commands.