diff options
author | Liang Qi <liang.qi@qt.io> | 2016-08-13 00:41:58 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2016-08-13 00:41:58 +0200 |
commit | d54d28981c90d23d7fa0cfc5a9e3049e3e4df6b5 (patch) | |
tree | 0eb2f54f16b014f6eaa362095393d1bd058adb52 /src/quick/items/qquickflickable.cpp | |
parent | 580f2872f09cf7ad83ec9ae5dca686683a3cac80 (diff) | |
parent | 6f15de1d2da9c83d7fca1d5c8243c0d69a1390ee (diff) |
Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
src/qml/compiler/qv4isel_moth.cpp
src/qml/compiler/qv4ssa_p.h
tests/benchmarks/qml/qqmlimage/qqmlimage.pro
tests/benchmarks/qml/qqmlimage/tst_qqmlimage.cpp
Change-Id: Iad11ce7fdf0c6d200fdebc16a94081bd8069a87a
Diffstat (limited to 'src/quick/items/qquickflickable.cpp')
-rw-r--r-- | src/quick/items/qquickflickable.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/quick/items/qquickflickable.cpp b/src/quick/items/qquickflickable.cpp index f72923a0d5..03b2a8128c 100644 --- a/src/quick/items/qquickflickable.cpp +++ b/src/quick/items/qquickflickable.cpp @@ -1234,13 +1234,17 @@ void QQuickFlickablePrivate::handleMouseMoveEvent(QMouseEvent *event) return; qint64 currentTimestamp = computeCurrentTime(event); - qreal elapsed = qreal(currentTimestamp - (lastPos.isNull() ? lastPressTime : lastPosTime)) / 1000.; QVector2D deltas = QVector2D(event->localPos() - pressPos); bool overThreshold = false; QVector2D velocity = QGuiApplicationPrivate::mouseEventVelocity(event); // TODO guarantee that events always have velocity so that it never needs to be computed here - if (!(QGuiApplicationPrivate::mouseEventCaps(event) & QTouchDevice::Velocity)) + if (!(QGuiApplicationPrivate::mouseEventCaps(event) & QTouchDevice::Velocity)) { + qint64 lastTimestamp = (lastPos.isNull() ? lastPressTime : lastPosTime); + if (currentTimestamp == lastTimestamp) + return; // events are too close together: velocity would be infinite + qreal elapsed = qreal(currentTimestamp - lastTimestamp) / 1000.; velocity = QVector2D(event->localPos() - (lastPos.isNull() ? pressPos : lastPos)) / elapsed; + } if (q->yflick()) overThreshold |= QQuickWindowPrivate::dragOverThreshold(deltas.y(), Qt::YAxis, event); |