summaryrefslogtreecommitdiffstats
path: root/examples/widgets/desktop/systray/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/widgets/desktop/systray/main.cpp')
-rw-r--r--examples/widgets/desktop/systray/main.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/examples/widgets/desktop/systray/main.cpp b/examples/widgets/desktop/systray/main.cpp
index d01f813d2f..37f6809a33 100644
--- a/examples/widgets/desktop/systray/main.cpp
+++ b/examples/widgets/desktop/systray/main.cpp
@@ -10,15 +10,15 @@
int main(int argc, char *argv[])
{
- Q_INIT_RESOURCE(systray);
-
QApplication app(argc, argv);
if (!QSystemTrayIcon::isSystemTrayAvailable()) {
- QMessageBox::critical(nullptr, QObject::tr("Systray"),
- QObject::tr("I couldn't detect any system tray "
- "on this system."));
- return 1;
+ auto choice = QMessageBox::critical(nullptr, QObject::tr("Systray"),
+ QObject::tr("I couldn't detect any system tray on this system."),
+ QMessageBox::Close | QMessageBox::Ignore);
+ if (choice == QMessageBox::Close)
+ return 1;
+ // Otherwise "lurk": if a system tray is started later, the icon will appear.
}
QApplication::setQuitOnLastWindowClosed(false);