Reputation: 99
I want the application to run in background even if the main window is closed.
I checked this one out and tried it but the application exits when I explicitly press exit button. I want the application to run in background even if I press exit explicitly.
I tried this
QApplication qApp;
qApp.setQuitOnLastWindowClosed(false);
Upvotes: 4
Views: 143
Reputation: 1
Use the concept of Daemon thread of multi-threading for the same. The thread continues to run even when the program is executed or exited.
Upvotes: 0
Reputation: 101
I think it's better for you to just try hiding main QWidget of your application using setVisible(false)
After that you'll need some way to open your main window back again(tray menu is first option I can come up with) with setVisible(true)
Upvotes: 5