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>
This commit is contained in:
parent
710ff392d9
commit
fa2aef5eb8
@ -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())
|
||||
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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user