aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquickcanvas.cpp
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.p.agocs@nokia.com>2012-06-04 16:06:40 +0300
committerQt by Nokia <qt-info@nokia.com>2012-06-06 08:08:30 +0200
commitd378c123159fc2731236573fb9b571dff882705e (patch)
tree07b6dccc37210563eb3511911e601e627f11b439 /src/quick/items/qquickcanvas.cpp
parentde4997ed4c08c63e54454629e9d78385330b4094 (diff)
Utilize StartDragVelocity style hint in Flickable
Change-Id: I96924b08aede57a0622ea3f7419e8f73a9f18f5d Reviewed-by: Martin Jones <martin.jones@nokia.com>
Diffstat (limited to 'src/quick/items/qquickcanvas.cpp')
-rw-r--r--src/quick/items/qquickcanvas.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/quick/items/qquickcanvas.cpp b/src/quick/items/qquickcanvas.cpp
index 619b08d7ae..363d4cd4c4 100644
--- a/src/quick/items/qquickcanvas.cpp
+++ b/src/quick/items/qquickcanvas.cpp
@@ -1711,6 +1711,22 @@ bool QQuickCanvasPrivate::sendFilteredMouseEvent(QQuickItem *target, QQuickItem
return false;
}
+bool QQuickCanvasPrivate::dragOverThreshold(qreal d, Qt::Axis axis, QMouseEvent *event)
+{
+ QStyleHints *styleHints = qApp->styleHints();
+ QQuickMouseEventEx *extended = QQuickMouseEventEx::extended(event);
+ bool dragVelocityLimitAvailable = extended
+ && extended->capabilities().testFlag(QTouchDevice::Velocity)
+ && styleHints->startDragVelocity();
+ bool overThreshold = qAbs(d) > styleHints->startDragDistance();
+ if (dragVelocityLimitAvailable) {
+ qreal velocity = axis == Qt::XAxis ? extended->velocity().x()
+ : extended->velocity().y();
+ overThreshold |= qAbs(velocity) > styleHints->startDragVelocity();
+ }
+ return overThreshold;
+}
+
/*!
Propagates an event to a QQuickItem on the canvas
*/