Undo actions.
-
I still think using the undo system ( if u need more than one level undo) is a better choice than make some sort of your own system.
-
@mrjj I don't remember, i work long time on this program, but i think nothing of long double need to be stored, ther is a structure with a template for percent calculations, so around 5 object's of them, does't need to be stores (Like i said, they gonna be re-calculated).
No, they are not pointers, i just put that " * " symbol, because i dont want write any names :)
In real it's:
struct:Data { // Names for the demonstration purposes int Name_A_Int; int Name_B_Int; int Name_C_Int; long double Name_A; long double Name_B; long double Name_C; long double Name_D; // And progress };
Ps. I am gonna try, will see what happend, i understood a little bit more, how it's gonna work, but i use it first time, and it's hard to use with a little bit bigger program.
-
@Loc888
Ahh next time use xxx as * screams pointer to us old ones :)
You could do something likeclass MyCommand : public QUndoCommand { public: enum { Id = 1234 }; MyCommand (struct_Data*data, long double * varToUse ,
so you give it the struct with data and the pointer to the member soi knows which of the values to alter.
Then when you push the command to the stack, you point the varToUse to the right one
inside struct. (else u need biiig if/switch case)You can make this very generic with templates if u know how to use such.
I have to go out now but ill be back tonight and can help get it running if still issues.
It looks more complicated than it is :)