summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@digia.com>2012-09-13 12:14:13 +0300
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-09-18 14:52:38 +0200
commitede4f5e23b08e9b2cc8fb6a449ee9f667b8da9fa (patch)
tree11175bab8835c6f40faed5afd8b57b41b3a1716f /src/plugins
parentbeab941e1fc11c8fe0914c6a3207ba029eb96112 (diff)
Fix mapping to/from global coordinates for child/embedded windows.
QWidget's mapToGlobal() and mapFromGlobal() functions assumed that if the widget reports it's a window or if it has no parent widget, it must be a top level window whose coordinates are in global coordinates. This is not true for child QWindows or embedded native windows (QAxWidgets). Changed the logic for mapping coordinates to use equivalent methods from QWindow if widget has a window handle, and changed QWindow's methods to map coordinates using native methods if window is embedded. Also fixed newly failing accessibility autotest. The geometry related failures there popped up because now the position of the rect returned by accessible interface is actually correct while widget geometry still reports position 0,0 before widget has shown up. Task-number: QTBUG-26436 Change-Id: I658fafd0ce01eb1604ba255efeeba3073ca0189f Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.cpp16
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.h3
2 files changed, 19 insertions, 0 deletions
diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp
index d9fcb99f42..1d458d5bb1 100644
--- a/src/plugins/platforms/windows/qwindowswindow.cpp
+++ b/src/plugins/platforms/windows/qwindowswindow.cpp
@@ -849,6 +849,22 @@ bool QWindowsWindow::isEmbedded(const QPlatformWindow *parentWindow) const
return m_data.embedded;
}
+QPoint QWindowsWindow::mapToGlobal(const QPoint &pos) const
+{
+ if (m_data.hwnd)
+ return QWindowsGeometryHint::mapToGlobal(m_data.hwnd, pos);
+ else
+ return pos;
+}
+
+QPoint QWindowsWindow::mapFromGlobal(const QPoint &pos) const
+{
+ if (m_data.hwnd)
+ return QWindowsGeometryHint::mapFromGlobal(m_data.hwnd, pos);
+ else
+ return pos;
+}
+
// 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 2171c7f725..a040aab2bd 100644
--- a/src/plugins/platforms/windows/qwindowswindow.h
+++ b/src/plugins/platforms/windows/qwindowswindow.h
@@ -155,6 +155,9 @@ public:
bool isVisible() const;
virtual bool isActive() const;
virtual bool isEmbedded(const QPlatformWindow *parentWindow) const;
+ virtual QPoint mapToGlobal(const QPoint &pos) const;
+ virtual QPoint mapFromGlobal(const QPoint &pos) const;
+
virtual Qt::WindowFlags setWindowFlags(Qt::WindowFlags flags);
virtual Qt::WindowState setWindowState(Qt::WindowState state);