diff options
author | Liang Qi <liang.qi@qt.io> | 2016-08-17 10:57:38 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2016-08-17 10:57:38 +0200 |
commit | 7e609f6d109f8bebb7e2fe4bd8867c5a4f8ece3d (patch) | |
tree | ecbd4f56e83a84233d42928e5554709ca8832ce1 /src/quick/items/qquickflickable.cpp | |
parent | 78f5b9e7f7295b9ba11da6908713fb938a1e0b90 (diff) | |
parent | c0f3c8ae5cee3ecda1ac8829336aa95cbe4d330e (diff) |
Merge remote-tracking branch 'origin/5.7' into dev
Conflicts:
src/qml/compiler/qqmltypecompiler.cpp
src/qml/compiler/qv4isel_moth.cpp
src/qml/compiler/qv4ssa_p.h
src/qml/qml/qqmlobjectcreator.cpp
Change-Id: I8bb7fe773d657f908f20ee5e72c2b9bd643f6260
Diffstat (limited to 'src/quick/items/qquickflickable.cpp')
-rw-r--r-- | src/quick/items/qquickflickable.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/quick/items/qquickflickable.cpp b/src/quick/items/qquickflickable.cpp index dcba5c2d71..31581c0f07 100644 --- a/src/quick/items/qquickflickable.cpp +++ b/src/quick/items/qquickflickable.cpp @@ -886,7 +886,7 @@ QQuickFlickableVisibleArea *QQuickFlickable::visibleArea() \li Flickable.AutoFlickIfNeeded - allows flicking vertically if the \e contentHeight is greater than the \e height of the Flickable. Allows flicking horizontally if the \e contentWidth is greater than - to the \e width of the Flickable. + to the \e width of the Flickable. (since \c{QtQuick 2.7}) \li Flickable.HorizontalFlick - allows flicking horizontally. \li Flickable.VerticalFlick - allows flicking vertically. \li Flickable.HorizontalAndVerticalFlick - allows flicking in both directions. @@ -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); |