From 46cadf7b48288fce4de6147ae38de493354c23d0 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Mon, 22 Nov 2021 17:39:20 +0100 Subject: QSystemTrayIcon example: ignore non-spontaneous QCloseEvent MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Apparently this code is needed on other platforms now, not only macOS. Pick-to: 6.2 Fixes: QTBUG-98504 Change-Id: Ie0a7e38609e8fc8c11915784dd3652a3517bb639 Reviewed-by: Paul Olav Tvete Reviewed-by: Jan Arve Sæther --- examples/widgets/desktop/systray/window.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'examples/widgets/desktop/systray/window.cpp') diff --git a/examples/widgets/desktop/systray/window.cpp b/examples/widgets/desktop/systray/window.cpp index e62b5fc0d0..f14a4e578f 100644 --- a/examples/widgets/desktop/systray/window.cpp +++ b/examples/widgets/desktop/systray/window.cpp @@ -111,11 +111,8 @@ void Window::setVisible(bool visible) //! [2] void Window::closeEvent(QCloseEvent *event) { -#ifdef Q_OS_MACOS - if (!event->spontaneous() || !isVisible()) { + if (!event->spontaneous() || !isVisible()) return; - } -#endif if (trayIcon->isVisible()) { QMessageBox::information(this, tr("Systray"), tr("The program will keep running in the " -- cgit v1.2.3