[SOLVED] Create undo actions
sharon_obl82 last edited by
I have a form with a few lineedits and a few buttons,one of them is the Undo button. The operation of this button is just to undo and retrieve back the previous value in the line edit fields. I've tried the undo() function but it clears up all the fields, not remembering the previous value in the field. Can someone please help me on code here?
nanthiran_2005 last edited by
Probably you can save the previous values in a stack, and create your own function as a slot when the button is pressed. In the function you could retrieve the old values from this stack and write it back on to the line edits.
PS: I am not sure if this is the best practice.
SGaist Lifetime Qt Champion last edited by
You should take a look at the QUndoCommand and friends classes. It looks exactly like what you are needing