diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2016-06-30 14:56:34 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2016-08-30 12:48:39 +0000 |
commit | fa2aef5eb8f1a28a79e253a006f348e62afef58a (patch) | |
tree | 397f0e5a25f803e4993381213dcc3193c19b17ca | |
parent | 710ff392d95fb2888c14ea273f4d65ced908fe49 (diff) |
Fix QWindowPrivate::globalPosition() for foreign windows
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 <jan-arve.saether@theqtcompany.com>
-rw-r--r-- | src/gui/kernel/qwindow_p.h | 10 |
1 files 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; } |