From a9a41961c6ef3627a8dd2bf69664c13d9cb20568 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Fri, 6 Mar 2015 11:08:04 +0100 Subject: [PATCH] Win QPA: Pass in the top level setting instead of relying on isTopLevel() When updateDropSite() is called then most of the time calling window()->isTopLevel() is enough. But in a case like while the window is being reparented it cannot be trusted. So we pass it as a variable so that it is possible to give it the correct information when it is being called. Task-number: QTBUG-39739 Change-Id: I77a7ceeaf78e89b1f65a10d60df86088b35e0fe5 Reviewed-by: Friedemann Kleint --- src/plugins/platforms/windows/qwindowswindow.cpp | 10 +++++----- src/plugins/platforms/windows/qwindowswindow.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index 0216b40e3e..54d1908e8b 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -933,7 +933,7 @@ QWindowsWindow::QWindowsWindow(QWindow *aWindow, const QWindowsWindowData &data) setFlag(OpenGL_ES2); } #endif // QT_NO_OPENGL - updateDropSite(); + updateDropSite(window()->isTopLevel()); #ifndef Q_OS_WINCE if ((QWindowsContext::instance()->systemInfo() & QWindowsContext::SI_SupportsTouch) @@ -1020,10 +1020,10 @@ void QWindowsWindow::destroyWindow() } } -void QWindowsWindow::updateDropSite() +void QWindowsWindow::updateDropSite(bool topLevel) { bool enabled = false; - if (window()->isTopLevel()) { + if (topLevel) { switch (window()->type()) { case Qt::Window: case Qt::Dialog: @@ -1306,7 +1306,7 @@ void QWindowsWindow::setParent_sys(const QPlatformWindow *parent) if (wasTopLevel != isTopLevel) { setDropSiteEnabled(false); setWindowFlags_sys(window()->flags(), unsigned(isTopLevel ? WindowCreationData::ForceTopLevel : WindowCreationData::ForceChild)); - updateDropSite(); + updateDropSite(isTopLevel); } } } @@ -1561,7 +1561,7 @@ void QWindowsWindow::setWindowFlags(Qt::WindowFlags flags) m_data.flags = flags; if (m_data.hwnd) { m_data = setWindowFlags_sys(flags); - updateDropSite(); + updateDropSite(window()->isTopLevel()); } } // When switching to a frameless window, geometry diff --git a/src/plugins/platforms/windows/qwindowswindow.h b/src/plugins/platforms/windows/qwindowswindow.h index 6d6d473ccd..0b42e77ecd 100644 --- a/src/plugins/platforms/windows/qwindowswindow.h +++ b/src/plugins/platforms/windows/qwindowswindow.h @@ -274,7 +274,7 @@ private: void destroyWindow(); inline bool isDropSiteEnabled() const { return m_dropTarget != 0; } void setDropSiteEnabled(bool enabled); - void updateDropSite(); + void updateDropSite(bool topLevel); void handleGeometryChange(); void handleWindowStateChange(Qt::WindowState state); inline void destroyIcon();