qt session
-
-
@shree_121
Well it sounds pretty crazy, but if that's what you really want to do...Of course it is not possible to have a program restart at some arbitrary point just because you feel like it (other than maybe if you're under Linux and deliberately create a
core
dump and reload from there, but we won't get into that...).You will have, in some shape or form, to save whatever you need to know (your "session state") to some external file/registry/whatever just before you restart the machine, and then when your program gets reloaded (which won't happen automatically, unless you have it auto-starting on boot) it will have to read that data and have code to get it back to whatever the appropriate point is in your code to be able to continue from where it left off.
None of which has anything to do with Qt....
-
Hi,
Depending on how you do it, QSessionManager might be of use. Note that this is a functionality that's usually tied to the desktop environment in use.
-
@shree_121
Here is an small example for Handling X11 Session Management . -
Hi@Ratzz ,
i followed your example i am not able to restore pushButton clicked event. Can Qsessionmanager also restores the QpushButton press events? Because i don't want start my for loop again and if i have to click on button after reboot then for loop starts from zero. -
No, you can't restore such a thing. You have to design your loop so it can be started from a "save point". Then on startup reload the data and that "save point" and start the loop.