[SOLVED] Create undo actions
General and Desktop
3
Posts
3
Posters
870
Views
1
Watching
-
wrote on 24 Jul 2014, 05:56 last edited by
Hi,
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?
Thank you -
wrote on 24 Jul 2014, 06:29 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.
-
Hi,
You should take a look at the QUndoCommand and friends classes. It looks exactly like what you are needing
1/3