Use QPlatformWindow::mapToGlobal()/mapFromGlobal() for Qt::ForeignWindow.

Task-number: QTBUG-43252
Task-number: QTBUG-41186
Change-Id: I91654b6591585dec9748982a0686becf3f5e2718
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
This commit is contained in:
Friedemann Kleint 2014-12-11 13:25:33 +01:00
parent 393fc2d4f5
commit 2f5c2ec12f

View File

@ -2238,10 +2238,12 @@ bool QWindow::nativeEvent(const QByteArray &eventType, void *message, long *resu
QPoint QWindow::mapToGlobal(const QPoint &pos) const QPoint QWindow::mapToGlobal(const QPoint &pos) const
{ {
Q_D(const QWindow); Q_D(const QWindow);
if (d->platformWindow && d->platformWindow->isEmbedded(0)) // QTBUG-43252, prefer platform implementation for foreign windows.
if (d->platformWindow
&& (type() == Qt::ForeignWindow || d->platformWindow->isEmbedded(0))) {
return d->platformWindow->mapToGlobal(pos); return d->platformWindow->mapToGlobal(pos);
else }
return pos + d_func()->globalPosition(); return pos + d_func()->globalPosition();
} }
@ -2256,10 +2258,12 @@ QPoint QWindow::mapToGlobal(const QPoint &pos) const
QPoint QWindow::mapFromGlobal(const QPoint &pos) const QPoint QWindow::mapFromGlobal(const QPoint &pos) const
{ {
Q_D(const QWindow); Q_D(const QWindow);
if (d->platformWindow && d->platformWindow->isEmbedded(0)) // QTBUG-43252, prefer platform implementation for foreign windows.
if (d->platformWindow
&& (type() == Qt::ForeignWindow || d->platformWindow->isEmbedded(0))) {
return d->platformWindow->mapFromGlobal(pos); return d->platformWindow->mapFromGlobal(pos);
else }
return pos - d_func()->globalPosition(); return pos - d_func()->globalPosition();
} }