QWidget::mapTo/FromGlobal(): Fix transformation for QGraphicsView with offsets

Amends 474af0a61d.

The code had an error showing when the QGraphicsView was not at 0,0
in the window.

Pick-to: 6.8
Task-number: QTBUG-128913
Task-number: QTBUG-52507
Change-Id: Ic228cc7e71ef54dd23c946b9d90f9c45aac793d9
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
This commit is contained in:
Friedemann Kleint 2024-10-30 16:24:18 +01:00
parent 25e16e20cc
commit 733459637e
1 changed files with 2 additions and 2 deletions

View File

@ -12695,8 +12695,8 @@ static MapToGlobalTransformResult mapToGlobalTransform(const QWidget *w)
break;
}
const QPoint topLeft = w->geometry().topLeft();
result.transform.translate(topLeft.x(), topLeft.y());
const auto &geometry = w->geometry();
result.transform *= QTransform::fromTranslate(geometry.x(), geometry.y());
if (w->isWindow())
break;
}