aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquickmultipointtoucharea.cpp
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2018-08-29 19:59:53 +0200
committerShawn Rutledge <shawn.rutledge@qt.io>2018-08-30 18:24:50 +0000
commit9e9acff340032bd4ec5ee6fbd1b13cd51e14ca3d (patch)
treee5ae9cb1f0316734e035f2428daf9a594e2aa4e3 /src/quick/items/qquickmultipointtoucharea.cpp
parent920f50731a8fe7507aece1318c9e91f3f12b525e (diff)
MultiPointTouchArea: capture the mouse position on press
QTouchEvent::TouchPoint already remembers the start position from where the touch point was pressed. But when MPTA handles mouse events, it populates a synthetic touchpoint (the _mouseQpaTouchPoint variable). So to be fully consistent, it needs to store the mouse press position there too. Since this was not done, gestureStarted was emitted for almost any mouse movement (while pressed) because the stored startPos was 0,0, so MPTA would nearly always think the drag threshold had already been exceeded. In a QML onGestureStarted callback gesture.touchPoints[0].startX and startY were always zero too. Amends fe2de633f9b9454ec8a9c2a5874ad85f49d8d54d Fixes: QTBUG-70258 Change-Id: I5bc0abbe0cb52c1aa02d60a76c52ec26bb0683e6 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Diffstat (limited to 'src/quick/items/qquickmultipointtoucharea.cpp')
-rw-r--r--src/quick/items/qquickmultipointtoucharea.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/quick/items/qquickmultipointtoucharea.cpp b/src/quick/items/qquickmultipointtoucharea.cpp
index b1438d7541..3eca535a67 100644
--- a/src/quick/items/qquickmultipointtoucharea.cpp
+++ b/src/quick/items/qquickmultipointtoucharea.cpp
@@ -610,6 +610,9 @@ void QQuickMultiPointTouchArea::updateTouchData(QEvent *event)
else { // QEvent::MouseButtonPress
addTouchPoint(me);
started = true;
+ _mouseQpaTouchPoint.setStartPos(me->localPos());
+ _mouseQpaTouchPoint.setStartScenePos(me->windowPos());
+ _mouseQpaTouchPoint.setStartScreenPos(me->screenPos());
_mouseQpaTouchPoint.setState(Qt::TouchPointPressed);
}
touchPoints << _mouseQpaTouchPoint;