aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquickwindow.cpp
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@theqtcompany.com>2016-08-03 14:22:28 +0200
committerShawn Rutledge <shawn.rutledge@qt.io>2016-08-03 20:03:11 +0000
commit7fc3ff63249b2db4fddf02bce38b5cd3afb64a2e (patch)
tree5bf9415b0d4455a9b49dbc223aa9fa6aef02848d /src/quick/items/qquickwindow.cpp
parentab7d780d3366f00f08406461ec8feac0dabf8175 (diff)
Move setting lastMousePosition out of QQuickWindowPrivate::translateTouchEvent
This setting of lastMousePosition is highly suspicious and was nicely hidden. Make it visible, then a check can be added, for example it shouldn't be set if we have a real mouse at the same time as touch events, so a check for the right device is certainly in order. Also remove a redundant .toPoint() which would result in converting to QPoint which was then cast back to QPointF. Change-Id: I8333cf366ce623f3beb20f556f31b50904c0112d Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src/quick/items/qquickwindow.cpp')
-rw-r--r--src/quick/items/qquickwindow.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp
index 22db30107c..024f326c3e 100644
--- a/src/quick/items/qquickwindow.cpp
+++ b/src/quick/items/qquickwindow.cpp
@@ -824,9 +824,6 @@ void QQuickWindowPrivate::translateTouchEvent(QTouchEvent *touchEvent)
touchPoint.setSceneRect(touchPoint.rect());
touchPoint.setStartScenePos(touchPoint.startPos());
touchPoint.setLastScenePos(touchPoint.lastPos());
-
- if (i == 0)
- lastMousePosition = touchPoint.pos().toPoint();
}
touchEvent->setTouchPoints(touchPoints);
}
@@ -1929,6 +1926,9 @@ bool QQuickWindowPrivate::compressTouchEvent(QTouchEvent *event)
void QQuickWindowPrivate::handleTouchEvent(QTouchEvent *event)
{
translateTouchEvent(event);
+ if (event->touchPoints().size())
+ lastMousePosition = event->touchPoints().at(0).pos();
+
qCDebug(DBG_TOUCH) << event;
if (qquickwindow_no_touch_compression || pointerEventRecursionGuard) {