[Solved] Keep my app running...



  • Hi guys.
    I'm developing an application which should run in background, and sometimes should show different dialogs. It has a tray icon in taskbar and everything is working fine, but I have one problem I wasn't able to solve. When the first dialog is closed, the application terminates and this is not the behavior I want to have (I want the app to be running, even after the dialog closes). To solve this, I added an empty dialog in the system which is created at startup but hidden. This also didn't solve the problem. If I don't hide the empty dialog and keep it shown, the application doesn't terminate.
    I know there should be an easy solution to my problem, I just don't know where to look :)
    I just want my app to keep running after the dialogs are closed.

    Your help is much appreciated.
    Thanks



  • You should use the property "quitOnLastWindowClosed":http://doc.qt.nokia.com/latest/qapplication.html#quitOnLastWindowClosed-prop of the QApplication object. Setting this to false should do the trick.


  • Moderators

    Probably you are close the window with the cross button or some other means to quit the whole application. Why do you give the window a button, which simply hides the window?



  • @Gerolf, thank you very much, it worked :)


Log in to reply
 

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