Code for an Undo option
-
hi and welcome
there is support viahttp://doc.qt.io/qt-5.5/qundo.html
But that said, it really depends on what you want to undo and how many levels back.
So it comes down to what kinda of data your application handles and what you do it and
what undo will do.Simple undo from say Delete is easy, as you can keep lasted
deleted object around until next delete.you can have a look at this example
http://www.walletfox.com/course/qundocommandexample.php -
hi and welcome
there is support viahttp://doc.qt.io/qt-5.5/qundo.html
But that said, it really depends on what you want to undo and how many levels back.
So it comes down to what kinda of data your application handles and what you do it and
what undo will do.Simple undo from say Delete is easy, as you can keep lasted
deleted object around until next delete.you can have a look at this example
http://www.walletfox.com/course/qundocommandexample.php -
@mrjj i am developing Linux calculator for that the undo is everything that we entered will be going in reverse format....i hope you understood..
-
Ok so the easy way is just to store a QUndoCommand each time
the state changes. Like add or remove digit.
Enter should be a bit special as you will have to keep the
buffer before doing the calc.I think the undo system will fully support your case.
Alternative, you could just store the current Input (1+2)
in a QStringList each time its changed
and then just take last string from there on undo.