Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Maintaining the state of application



  • Hi,
    Is there a mechanism in qt to preserve the state of the application
    For example i have a camera device scanning a platform and suddenly the power goes off.
    How can i continue the scanning from that point or maintain the state of application to start from
    that point



  • @kira
    There is no standard technology for "Maintaining the state of application". Qt neither helps nor hinders this. I don't know about the specifics of your scanning, but it is up to you, the programmer, to save whatever state you need as you go along and to write code which uses that to restart from a similar situation.


  • Lifetime Qt Champion

    Hi
    You can get help by using
    https://doc.qt.io/qt-5/qmainwindow.html#saveState
    https://doc.qt.io/qt-5/qmainwindow.html#restoreState
    but any state that is related to app related activities must be handled manually.
    Often QSetting class is used to store the settings store in.



  • If you have definite progress points and can verify those points. Then you can simply have your program look for a job in progress and continue from that point on restart. I had a script I wrote in Python. It would look at the filenames in a directory. If they existed it would start after the last file to start processing data again. So you could have incremental saved files for something like this.

    Another option is running this from a laptop and/or ups.


Log in to reply