diff options
Diffstat (limited to 'src/gui/kernel/qplatformwindow.cpp')
-rw-r--r-- | src/gui/kernel/qplatformwindow.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/gui/kernel/qplatformwindow.cpp b/src/gui/kernel/qplatformwindow.cpp index b710701e7f..1eec6bfefc 100644 --- a/src/gui/kernel/qplatformwindow.cpp +++ b/src/gui/kernel/qplatformwindow.cpp @@ -197,7 +197,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; } /*! @@ -209,7 +215,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; } /*! |