diff options
author | Gabriel de Dietrich <gabriel.dedietrich@digia.com> | 2014-02-18 17:13:48 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-02-26 14:21:11 +0100 |
commit | 76ec5710d544dd19ef13c467bfcb1e441af56499 (patch) | |
tree | 4da522753bb36d0ec50be16f5f8ab99341439ebd /src/controls/qquickpopupwindow.cpp | |
parent | 1c54d411ad6e98c3779a412750aec8b93d587872 (diff) | |
download | qtquickcontrols-76ec5710d544dd19ef13c467bfcb1e441af56499.tar.gz |
Close popup windows when application state changesold/5.2
Nobody is telling the popup to close. If it was, that was probably as a
side effect of the Qt::Popup flag on some platforms. Certainly not on
Windows.
We check for the application state as the application may use a popup
to signal the user about some event happening, and we don't want to close
the popup as soon as the user makes the application active again.
Task-number: QTBUG-36474
Change-Id: If41f7bec696105e3c7d8897e9af5fc075c7b8933
Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
Diffstat (limited to 'src/controls/qquickpopupwindow.cpp')
-rw-r--r-- | src/controls/qquickpopupwindow.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/controls/qquickpopupwindow.cpp b/src/controls/qquickpopupwindow.cpp index 02c50a85..7e36c8d1 100644 --- a/src/controls/qquickpopupwindow.cpp +++ b/src/controls/qquickpopupwindow.cpp @@ -54,6 +54,14 @@ QQuickPopupWindow::QQuickPopupWindow() : { setFlags(Qt::Popup); setModality(Qt::ApplicationModal); + connect(qApp, SIGNAL(applicationStateChanged(Qt::ApplicationState)), + this, SLOT(applicationStateChanged(Qt::ApplicationState))); +} + +void QQuickPopupWindow::applicationStateChanged(Qt::ApplicationState state) +{ + if (state != Qt::ApplicationActive) + dismissPopup(); } void QQuickPopupWindow::show() |