diff options
author | Alejandro Exojo <suy@badopi.org> | 2015-10-31 13:17:02 +0100 |
---|---|---|
committer | Alejandro Exojo Piqueras <suy@badopi.org> | 2015-11-03 09:01:36 +0000 |
commit | 115f303352df90a0ceeea2af167a8592da33cd82 (patch) | |
tree | ee7f733df181a684d22f9e2819ff443de8afbf88 /examples/widgets/desktop/systray/window.cpp | |
parent | 0f68f8920573cdce1729a285a92ac8582df32841 (diff) |
Fix the closeEvent of the systray example on OS X
The implementation of the close event handler requires handling the two
close events that are received on OS X when the user quits through the
application menu bar or the Command+Q shortcut. The first is an
spontaneous event, and the second a non-spontaneous one with the window
already closed.
Change-Id: I24e3d3f0de4d631bd2d5616c85ce747f085691e0
Reviewed-by: Topi Reiniƶ <topi.reinio@digia.com>
Diffstat (limited to 'examples/widgets/desktop/systray/window.cpp')
-rw-r--r-- | examples/widgets/desktop/systray/window.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/examples/widgets/desktop/systray/window.cpp b/examples/widgets/desktop/systray/window.cpp index 931e443de7..d499f498af 100644 --- a/examples/widgets/desktop/systray/window.cpp +++ b/examples/widgets/desktop/systray/window.cpp @@ -102,6 +102,11 @@ void Window::setVisible(bool visible) //! [2] void Window::closeEvent(QCloseEvent *event) { +#ifdef Q_OS_OSX + if (!event->spontaneous() || !isVisible()) { + return; + } +#endif if (trayIcon->isVisible()) { QMessageBox::information(this, tr("Systray"), tr("The program will keep running in the " |