aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquickevents_p_p.h
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.p.agocs@nokia.com>2012-03-01 13:45:29 +0200
committerQt by Nokia <qt-info@nokia.com>2012-03-02 08:26:52 +0100
commit82a252afdd0f920357b1e543f2ee97f92c34919b (patch)
treeac9d56f277d24e915b6d6715ec8622b1dac7d7b8 /src/quick/items/qquickevents_p_p.h
parent3c42ca87fac3326bb86a8bb816de07223b7b2e9d (diff)
Use velocity from touch events only when they are valid
Add the capability flags to the extended mouse events. Otherwise it is not possible to tell if the velocity is valid. While the original version is fine if velocity is guaranteed to be available whenever QT_TRANSLATE_TOUCH_TO_MOUSE is set, some platform and driver combinations, e.g. the evdevtouch plugin that comes with Qt, do not provide velocity data in touch events. The touch-only mode of QML may be very useful in these cases too, we just need to fall back to the built-in velocity calculation. Change-Id: Iec5e7632a66380dc04c9435b09f5c173107bbe00 Reviewed-by: Martin Jones <martin.jones@nokia.com>
Diffstat (limited to 'src/quick/items/qquickevents_p_p.h')
-rw-r--r--src/quick/items/qquickevents_p_p.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/quick/items/qquickevents_p_p.h b/src/quick/items/qquickevents_p_p.h
index 1d13a19fed..7ff4835b4c 100644
--- a/src/quick/items/qquickevents_p_p.h
+++ b/src/quick/items/qquickevents_p_p.h
@@ -163,8 +163,11 @@ public:
QQuickMouseEventEx(const QMouseEvent &event)
: QMouseEvent(event)
{
- if (extended(&event))
- setVelocity(extended(&event)->velocity());
+ const QQuickMouseEventEx *eventEx = extended(&event);
+ if (eventEx) {
+ setVelocity(eventEx->velocity());
+ setCapabilities(eventEx->capabilities());
+ }
}
static const QQuickMouseEventEx *extended(const QMouseEvent *e) {
@@ -186,8 +189,15 @@ public:
}
QVector2D velocity() const { return _velocity; }
+ void setCapabilities(QTouchDevice::Capabilities caps) {
+ setExtended();
+ _capabilities = caps;
+ }
+ QTouchDevice::Capabilities capabilities() const { return _capabilities; }
+
private:
QVector2D _velocity;
+ QTouchDevice::Capabilities _capabilities;
};