Move QWindowPrivate::globalPosition() definition out of header

Change-Id: Icaf68600a20d1845a5667a49306686948a20b42e
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
bb10
Tor Arne Vestbø 2016-11-21 12:27:31 +01:00
parent 2a151bbe49
commit 69d0eafa08
2 changed files with 15 additions and 13 deletions

View File

@ -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)
{

View File

@ -123,19 +123,7 @@ public:
void deliverUpdateRequest();
QPoint 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 { // QTBUG-43252, mapToGlobal() for foreign children.
offset += p->mapToGlobal(QPoint(0, 0));
break;
}
}
return offset;
}
QPoint globalPosition() const;
QWindow *topLevelWindow() const;