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

Amends 474af0a61d6154006966a775d186687aa8881708.

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

Task-number: QTBUG-128913
Task-number: QTBUG-52507
Change-Id: Ic228cc7e71ef54dd23c946b9d90f9c45aac793d9
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 733459637e10edca006b0ad9b68299496e1b4ebd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Friedemann Kleint 2024-10-30 16:24:18 +01:00 committed by Qt Cherry-pick Bot
parent 607ac728ed
commit 9d5e3ffc33

View File

@ -12658,8 +12658,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;
}