From fa2aef5eb8f1a28a79e253a006f348e62afef58a Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 30 Jun 2016 14:56:34 +0200 Subject: Fix QWindowPrivate::globalPosition() for foreign windows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use mapToGlobal(QPoint(0, 0)) when encountering a foreign window in the parent hierarchy as it is not clear whether it is a native top level or child. In the latter case, using the position is not sufficient. Task-number: QTBUG-43252 Change-Id: I5eebb1f0dbc6a0abbd968c5d383d3eded75c11a5 Reviewed-by: Jan Arve Sæther --- src/gui/kernel/qwindow_p.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/gui/kernel/qwindow_p.h b/src/gui/kernel/qwindow_p.h index ccd14f66ae..4020376feb 100644 --- a/src/gui/kernel/qwindow_p.h +++ b/src/gui/kernel/qwindow_p.h @@ -125,8 +125,14 @@ public: QPoint globalPosition() const { Q_Q(const QWindow); QPoint offset = q->position(); - for (const QWindow *p = q->parent(); p; p = p->parent()) - offset += p->position(); + for (const QWindow *p = q->parent(); p; p = p->parent()) { + if (p->type() != Qt::ForeignWindow) { + offset += p->position(); + } else { // QTBUG-43252, mapToGlobal() for foreign children. + offset += p->mapToGlobal(QPoint(0, 0)); + break; + } + } return offset; } -- cgit v1.2.3