diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2016-11-21 12:27:31 +0100 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2016-11-23 22:40:55 +0000 |
commit | 69d0eafa085324c0c8c0d198544b3df7e8f89d3e (patch) | |
tree | a1d775a76c03a3f4bb35ccfa7612cfb202836c3e /src/gui/kernel/qwindow.cpp | |
parent | 2a151bbe4998261533972db1ac0af0f23ae69278 (diff) |
Move QWindowPrivate::globalPosition() definition out of header
Change-Id: Icaf68600a20d1845a5667a49306686948a20b42e
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'src/gui/kernel/qwindow.cpp')
-rw-r--r-- | src/gui/kernel/qwindow.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index 4822793ae7..ba7fc8533f 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -2444,6 +2444,20 @@ QPoint QWindow::mapFromGlobal(const QPoint &pos) const return pos - d->globalPosition(); } +QPoint QWindowPrivate::globalPosition() const +{ + Q_Q(const QWindow); + QPoint offset = q->position(); + for (const QWindow *p = q->parent(); p; p = p->parent()) { + if (p->type() != Qt::ForeignWindow) { + offset += p->position(); + } else { // Use mapToGlobal() for foreign windows + offset += p->mapToGlobal(QPoint(0, 0)); + break; + } + } + return offset; +} Q_GUI_EXPORT QWindowPrivate *qt_window_private(QWindow *window) { |