diff options
author | Mauro Persano <mauro.persano@kdab.com> | 2018-03-29 10:37:25 -0300 |
---|---|---|
committer | Mauro Persano <mauro.persano@kdab.com> | 2018-03-29 15:07:45 +0000 |
commit | 2e496e93225503c8af068e53294c5eb13aa3bfd7 (patch) | |
tree | 123ee4bad259c9bfb5b1124bf32feeb2bfed2cdc /src | |
parent | ee6164942d21e7db5b5a6520cb0dbe1b9d631b21 (diff) |
Windows: handle multiple transient children when closing windows
On Windows, we must update the transient children of a window that's
about to be destroyed or its transient children will be destroyed as
well. This is already being done in the case of a single transient
child, but there are still problems when there are more than one.
Change-Id: Ib0de6767bf43dca508ecdb87cbdfedb59e9146e8
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/platforms/windows/qwindowswindow.cpp | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index 9fff4b5e42..9872b6b4e0 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -1161,23 +1161,19 @@ void QWindowsWindow::fireExpose(const QRegion ®ion, bool force) QWindowSystemInterface::handleExposeEvent(window(), region); } -static inline QWindow *findTransientChild(const QWindow *parent) -{ - foreach (QWindow *w, QGuiApplication::topLevelWindows()) - if (w->transientParent() == parent) - return w; - return 0; -} - void QWindowsWindow::destroyWindow() { qCDebug(lcQpaWindows) << __FUNCTION__ << this << window() << m_data.hwnd; if (m_data.hwnd) { // Stop event dispatching before Window is destroyed. setFlag(WithinDestroy); // Clear any transient child relationships as Windows will otherwise destroy them (QTBUG-35499, QTBUG-36666) - if (QWindow *transientChild = findTransientChild(window())) - if (QWindowsWindow *tw = QWindowsWindow::windowsWindowOf(transientChild)) - tw->updateTransientParent(); + const auto tlw = QGuiApplication::topLevelWindows(); + for (QWindow *w : tlw) { + if (w->transientParent() == window()) { + if (QWindowsWindow *tw = QWindowsWindow::windowsWindowOf(w)) + tw->updateTransientParent(); + } + } QWindowsContext *context = QWindowsContext::instance(); if (context->windowUnderMouse() == window()) context->clearWindowUnderMouse(); |