path: root/tests
diff options
authorFriedemann Kleint <>2015-12-22 17:15:57 +0100
committerFriedemann Kleint <>2016-01-05 08:18:18 +0000
commit38c8af7231823429ca6cb9ea6418e2dcef3691a0 (patch)
tree51ff210dadd4af1dd4c6260cece6e89830fdf741 /tests
parent4829edfa4ec4829c25246c46d3fcf236e6e59657 (diff)
Revert "Fix global coordinate mapping for child widgets in QGraphicsView."
This reverts commit 56aad2ad6074237537fecf10d0cda0f3872e7f71. QWidget::mapFromGlobal() does not work correctly when the widget is a child widget of another widget embedded into a QGraphicsView with a transformation (scaling/rotation). It starts applying offsets going up the widget tree (just as mapToGlobal) until it hits the embedded widget not taking into account the transformation. It would need to go in from to top to bottom or better be reimplemented such that a QTransform for mapping coordinates from/to global is determined which is then applied in reverse. Task-number: QTBUG-50030 Task-number: QTBUG-50136 Change-Id: Iadeb891d793be1938c64942bfbf38d541a281c33 Reviewed-by: Marc Mutz <>
Diffstat (limited to 'tests')
1 files changed, 7 insertions, 1 deletions
diff --git a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
index cd40c5541c..f3a683fe8b 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
@@ -3684,6 +3684,7 @@ void tst_QGraphicsProxyWidget::mapToGlobal() // QTBUG-41135
const QSize size = availableGeometry.size() / 5;
QGraphicsScene scene;
QGraphicsView view(&scene);
+ view.setTransform(QTransform::fromScale(2, 2)); // QTBUG-50136, use transform.
view.move(availableGeometry.bottomRight() - QPoint(size.width(), size.height()) - QPoint(100, 100));
@@ -3706,10 +3707,15 @@ void tst_QGraphicsProxyWidget::mapToGlobal() // QTBUG-41135
QVERIFY2((viewCenter - embeddedCenterGlobal).manhattanLength() <= 2,
msgPointMismatch(embeddedCenterGlobal, viewCenter).constData());
- // Same test with child centered on embeddedWidget
+ // Same test with child centered on embeddedWidget. The correct
+ // mapping is not implemented yet, but at least make sure
+ // the roundtrip maptoGlobal()/mapFromGlobal() returns the same
+ // point since that is important for mouse event handling (QTBUG-50030,
+ // QTBUG-50136).
const QPoint childCenter = childWidget->rect().center();
const QPoint childCenterGlobal = childWidget->mapToGlobal(childCenter);
QCOMPARE(childWidget->mapFromGlobal(childCenterGlobal), childCenter);
+ QEXPECT_FAIL("", "Not implemented for child widgets of embedded widgets", Continue);
QVERIFY2((viewCenter - childCenterGlobal).manhattanLength() <= 4,
msgPointMismatch(childCenterGlobal, viewCenter).constData());