summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@digia.com>2012-08-17 14:19:36 +0300
committerQt by Nokia <qt-info@nokia.com>2012-08-20 10:48:09 +0200
commit333f641622c795a4b826d2d48aeabd5b5eab6e90 (patch)
treea178ae15e995668d3f4959503983a4da449d91a7 /src/plugins/platforms
parent9ea9ec1cbb567197ce0bf44ea58a79308c9b64d8 (diff)
Fix in-process QAxServers inside modal windows.
The main window of in-process QAxServers doesn't have QWindow parent, but it does have native parent that is part of the native window tree of the application. The lack of Qt parent makes embedded controls look like toplevel windows, which causes problems e.g. with modality. Introduced new optional method QPlatformWindow::isEmbedded() to detect if a window is an embedded window and utilized it in proper places during modality handling. Task-number: QTBUG-26871 Change-Id: Iac9a51dae06b8fc15410de7838857e203e4275b8 Reviewed-by: Andreas Holzammer <andreas.holzammer@kdab.com> Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.cpp16
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.h1
2 files changed, 17 insertions, 0 deletions
diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp
index 8f376162ef..7e79e1c819 100644
--- a/src/plugins/platforms/windows/qwindowswindow.cpp
+++ b/src/plugins/platforms/windows/qwindowswindow.cpp
@@ -424,6 +424,7 @@ QWindowsWindow::WindowData
if (desktop) { // desktop widget. No frame, hopefully?
result.hwnd = GetDesktopWindow();
result.geometry = frameGeometry(result.hwnd, true);
+ result.embedded = false;
if (QWindowsContext::verboseWindows)
qDebug().nospace() << "Created desktop window " << w << result.hwnd;
return result;
@@ -830,6 +831,21 @@ bool QWindowsWindow::isActive() const
return false;
}
+bool QWindowsWindow::isEmbedded(const QPlatformWindow *parentWindow) const
+{
+ if (parentWindow) {
+ const QWindowsWindow *ww = static_cast<const QWindowsWindow *>(parentWindow);
+ const HWND hwnd = ww->handle();
+ if (!IsChild(hwnd, m_data.hwnd))
+ return false;
+ }
+
+ if (!m_data.embedded && parent())
+ return parent()->isEmbedded(0);
+
+ return m_data.embedded;
+}
+
// partially from QWidgetPrivate::show_sys()
void QWindowsWindow::show_sys() const
{
diff --git a/src/plugins/platforms/windows/qwindowswindow.h b/src/plugins/platforms/windows/qwindowswindow.h
index 8e6ff9f891..35790e2739 100644
--- a/src/plugins/platforms/windows/qwindowswindow.h
+++ b/src/plugins/platforms/windows/qwindowswindow.h
@@ -154,6 +154,7 @@ public:
virtual void setVisible(bool visible);
bool isVisible() const;
virtual bool isActive() const;
+ virtual bool isEmbedded(const QPlatformWindow *parentWindow) const;
virtual Qt::WindowFlags setWindowFlags(Qt::WindowFlags flags);
virtual Qt::WindowState setWindowState(Qt::WindowState state);