Make Qt application not to quit when last window is closed

后端 未结 1 1037
感动是毒
感动是毒 2020-12-17 17:12

I\'ve created a Qt application that acts mostly as a daemon, but occasionally shows a dialog.

Now, I know the default behavior is to close the application when the

1条回答
  •  生来不讨喜
    2020-12-17 18:07

    You can set the QApplication::quitOnLastWindowClosed property to false:

    ...
    QApplication qApp;
    qApp.setQuitOnLastWindowClosed(false);
    ...
    

    0 讨论(0)
提交回复
热议问题