From c48f4bde0044bd5b23af231f3639d0779ecbdb03 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Thu, 1 Feb 2018 20:59:58 +0100 Subject: Set the ellipseDiameters back to the original size in QGraphicsView When calling setSceneRect() on a QTouchPoint it will cause the ellipseDiameters to be changed, whereas this should not be affected by the scene rectangle as it should be in logical pixels. Also add a manual test for visually checking the ellipse diameters on various devices. Change-Id: I1ee9207cb1a63cfef33fe904594c73aba221af5c Reviewed-by: Shawn Rutledge --- src/widgets/graphicsview/qgraphicsview.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/widgets/graphicsview') diff --git a/src/widgets/graphicsview/qgraphicsview.cpp b/src/widgets/graphicsview/qgraphicsview.cpp index 1cc8543fdd..0c847b899e 100644 --- a/src/widgets/graphicsview/qgraphicsview.cpp +++ b/src/widgets/graphicsview/qgraphicsview.cpp @@ -313,13 +313,15 @@ void QGraphicsViewPrivate::translateTouchEvent(QGraphicsViewPrivate *d, QTouchEv QList touchPoints = touchEvent->touchPoints(); for (int i = 0; i < touchPoints.count(); ++i) { QTouchEvent::TouchPoint &touchPoint = touchPoints[i]; + const QSizeF ellipseDiameters = touchPoint.ellipseDiameters(); // the scene will set the item local pos, startPos, lastPos, and rect before delivering to // an item, but for now those functions are returning the view's local coordinates - touchPoint.setSceneRect(d->mapToScene(touchPoint.rect())); + touchPoint.setScenePos(d->mapToScene(touchPoint.pos())); touchPoint.setStartScenePos(d->mapToScene(touchPoint.startPos())); touchPoint.setLastScenePos(d->mapToScene(touchPoint.lastPos())); + touchPoint.setEllipseDiameters(ellipseDiameters); - // screenPos, startScreenPos, lastScreenPos, and screenRect are already set + // screenPos, startScreenPos, and lastScreenPos are already set } touchEvent->setTouchPoints(touchPoints); -- cgit v1.2.3