summaryrefslogtreecommitdiffstats
path: root/examples/widgets/desktop/systray
diff options
context:
space:
mode:
Diffstat (limited to 'examples/widgets/desktop/systray')
-rw-r--r--examples/widgets/desktop/systray/main.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/examples/widgets/desktop/systray/main.cpp b/examples/widgets/desktop/systray/main.cpp
index d13bde11ce..37f6809a33 100644
--- a/examples/widgets/desktop/systray/main.cpp
+++ b/examples/widgets/desktop/systray/main.cpp
@@ -13,10 +13,12 @@ int main(int argc, char *argv[])
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);