summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qplatformwindow.cpp
diff options
context:
space:
mode:
authorSamuel Rødal <samuel.rodal@digia.com>2012-12-05 14:27:41 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-01-29 09:28:43 +0100
commitd78bd439dcb290e4318734693d418937b0bf8129 (patch)
tree97ea50c14e621cd41ac1d09e66a8354797f7ba28 /src/gui/kernel/qplatformwindow.cpp
parent00ad768f10fea7c291bd3e0609c54965fb69df86 (diff)
Offscreen testing platform plugin
Useful for running auto-tests without popping up a bunch of windows in the windowing system. Thus they can be run in the background and even in parallel without focus issues. Change-Id: I8b14c6de258b41225480a0af5a2a9553663bc2b7 Reviewed-by: Jason McDonald <macadder1@gmail.com>
Diffstat (limited to 'src/gui/kernel/qplatformwindow.cpp')
-rw-r--r--src/gui/kernel/qplatformwindow.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/gui/kernel/qplatformwindow.cpp b/src/gui/kernel/qplatformwindow.cpp
index 01377d1aa0..88a82b12a3 100644
--- a/src/gui/kernel/qplatformwindow.cpp
+++ b/src/gui/kernel/qplatformwindow.cpp
@@ -196,7 +196,13 @@ bool QPlatformWindow::isEmbedded(const QPlatformWindow *parentWindow) const
*/
QPoint QPlatformWindow::mapToGlobal(const QPoint &pos) const
{
- return pos;
+ const QPlatformWindow *p = this;
+ QPoint result = pos;
+ while (p) {
+ result += p->geometry().topLeft();
+ p = p->parent();
+ }
+ return result;
}
/*!
@@ -208,7 +214,13 @@ QPoint QPlatformWindow::mapToGlobal(const QPoint &pos) const
*/
QPoint QPlatformWindow::mapFromGlobal(const QPoint &pos) const
{
- return pos;
+ const QPlatformWindow *p = this;
+ QPoint result = pos;
+ while (p) {
+ result -= p->geometry().topLeft();
+ p = p->parent();
+ }
+ return result;
}
/*!