diff options
Diffstat (limited to 'examples/widgets/desktop')
-rw-r--r-- | examples/widgets/desktop/CMakeLists.txt | 2 | ||||
-rw-r--r-- | examples/widgets/desktop/systray/main.cpp | 10 |
2 files changed, 8 insertions, 4 deletions
diff --git a/examples/widgets/desktop/CMakeLists.txt b/examples/widgets/desktop/CMakeLists.txt index 169fa9ffac..0f4eda12aa 100644 --- a/examples/widgets/desktop/CMakeLists.txt +++ b/examples/widgets/desktop/CMakeLists.txt @@ -1,2 +1,4 @@ +# Copyright (C) 2024 The Qt Company Ltd. +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause qt_internal_add_example(screenshot) qt_internal_add_example(systray) 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); |