summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2016-12-20 09:10:55 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2017-01-23 11:41:56 +0000
commit4b1d825ddcd1c116b158039e4772ee41c9785104 (patch)
tree0ccd1e54e16820343368a4a5fed537cb39fe3207
parent4d7313a466dd775e58705924f72525d4838c70fe (diff)
QGuiApplication: Send QEvent::Window(Un)blocked to embedded window, too
Change 333f641622c795a4b826d2d48aeabd5b5eab6e90 modified QGuiApplication::topLevelWindows() to no longer include embedded windows. This causes the blocked handling in Active Qt to no longer be triggered. Fix this by iterating over the list using the same condition as before, avoiding the construction of a temporary list as a side effect. Task-number: QTBUG-18099 Change-Id: I06a1a4e324fea9f543ceb5274bb064734f8d56af Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io> Reviewed-by: Andy Shaw <andy.shaw@qt.io>
-rw-r--r--src/gui/kernel/qguiapplication.cpp20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index 98cdecc444..71f27db6b7 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -759,6 +759,14 @@ void QGuiApplicationPrivate::updateBlockedStatus(QWindow *window)
updateBlockedStatusRecursion(window, shouldBeBlocked);
}
+// Return whether the window needs to be notified about window blocked events.
+// As opposed to QGuiApplication::topLevelWindows(), embedded windows are
+// included in this list (QTBUG-18099).
+static inline bool needsWindowBlockedEvent(const QWindow *w)
+{
+ return w->isTopLevel() && w->type() != Qt::Desktop;
+}
+
void QGuiApplicationPrivate::showModalWindow(QWindow *modal)
{
self->modalWindowList.prepend(modal);
@@ -776,10 +784,8 @@ void QGuiApplicationPrivate::showModalWindow(QWindow *modal)
}
}
- QWindowList windows = QGuiApplication::topLevelWindows();
- for (int i = 0; i < windows.count(); ++i) {
- QWindow *window = windows.at(i);
- if (!window->d_func()->blockedByModalWindow)
+ for (QWindow *window : qAsConst(QGuiApplicationPrivate::window_list)) {
+ if (needsWindowBlockedEvent(window) && !window->d_func()->blockedByModalWindow)
updateBlockedStatus(window);
}
@@ -790,10 +796,8 @@ void QGuiApplicationPrivate::hideModalWindow(QWindow *window)
{
self->modalWindowList.removeAll(window);
- QWindowList windows = QGuiApplication::topLevelWindows();
- for (int i = 0; i < windows.count(); ++i) {
- QWindow *window = windows.at(i);
- if (window->d_func()->blockedByModalWindow)
+ for (QWindow *window : qAsConst(QGuiApplicationPrivate::window_list)) {
+ if (needsWindowBlockedEvent(window) && window->d_func()->blockedByModalWindow)
updateBlockedStatus(window);
}
}