Application is not running after computers reboot



  • Hello.
    I have such code:
    class Application : public QApplication;
    ...
    void Application::PreShutdown(QSessionManager& sm)
    {
    sm.setRestartHint(QSessionManager::RestartIfRunning);
    }
    ...
    Application::Application(int argc, char** argv)
    : QApplication(argc, argv),
    {
    QObject::connect(this, SIGNAL(saveStateRequest(QSessionManager&)),
    SLOT(PreShutdown(QSessionManager&)));
    }

    I tried QSessionManager::RestartIfRunning, QSessionManager::RestartAnyway, QSessionManager::RestartImmediately, but after reboot my application is not running.
    What's wrong? OS: Windows 7 Qt: 5.3.1



  • Hi, if you want an application to start when you turn on the power or reboot your computer, easiest I think is to place a shortcut to the application in the Autostart folder in your Start menu.

    QSessionManager doesn't seem to do that for you, perhaps you need to do it manually.



  • @hskoglund Thanks for reply.
    In fact, I want to run my application after reboot only if it was running where computer was rebooted.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.