aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquickmultipointtoucharea.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/quick/items/qquickmultipointtoucharea.cpp')
-rw-r--r--src/quick/items/qquickmultipointtoucharea.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/quick/items/qquickmultipointtoucharea.cpp b/src/quick/items/qquickmultipointtoucharea.cpp
index 766ce67e43..c1c60c1756 100644
--- a/src/quick/items/qquickmultipointtoucharea.cpp
+++ b/src/quick/items/qquickmultipointtoucharea.cpp
@@ -102,14 +102,19 @@ void QQuickTouchPoint::setY(qreal y)
/*!
\qmlproperty real QtQuick2::TouchPoint::pressure
+ \qmlproperty vector2d QtQuick2::TouchPoint::velocity
\qmlproperty rectangle QtQuick2::TouchPoint::area
These properties hold additional information about the current state of the touch point.
\list
\i \c pressure is a value in the range of 0.0 to 1.0.
+ \i \c velocity is a vector with magnitude reported in pixels per second.
\i \c area is a rectangle covering the area of the touch point, centered on the current position of the touch point.
\endlist
+
+ Not all touch devices support velocity. If velocity is not supported, it will be reported
+ as 0,0.
*/
void QQuickTouchPoint::setPressure(qreal pressure)
{
@@ -119,6 +124,14 @@ void QQuickTouchPoint::setPressure(qreal pressure)
emit pressureChanged();
}
+void QQuickTouchPoint::setVelocity(const QVector2D &velocity)
+{
+ if (_velocity == velocity)
+ return;
+ _velocity = velocity;
+ emit velocityChanged();
+}
+
void QQuickTouchPoint::setArea(const QRectF &area)
{
if (_area == area)
@@ -548,6 +561,7 @@ void QQuickMultiPointTouchArea::updateTouchPoint(QQuickTouchPoint *dtp, const QT
dtp->setX(p->pos().x());
dtp->setY(p->pos().y());
dtp->setPressure(p->pressure());
+ dtp->setVelocity(p->velocity());
dtp->setArea(p->rect());
dtp->setStartX(p->startPos().x());
dtp->setStartY(p->startPos().y());