aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/handlers/qquickhandlerpoint.cpp
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2018-05-16 13:05:23 +0200
committerShawn Rutledge <shawn.rutledge@qt.io>2018-05-18 15:12:39 +0000
commit412bedc70b32b09f4bb91a3a0503d46d19f2481a (patch)
treed9422efad1361f138c6d912dbff2edbdca0bc4e4 /src/quick/handlers/qquickhandlerpoint.cpp
parent52d35526f256bf4c8155f5e660a214ab8a2efbdf (diff)
Add QQuickHandlerPoint::modifiers property
The event includes it; this exposes it to QML, for the benefit of conditional JS logic in Pointer Handler use cases. Task-number: QTBUG-68101 Change-Id: I3f04c5db7f5aef461edb6168922b70e3fb3bda37 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Diffstat (limited to 'src/quick/handlers/qquickhandlerpoint.cpp')
-rw-r--r--src/quick/handlers/qquickhandlerpoint.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/quick/handlers/qquickhandlerpoint.cpp b/src/quick/handlers/qquickhandlerpoint.cpp
index 6c7bf2fc8a..b40164d3ec 100644
--- a/src/quick/handlers/qquickhandlerpoint.cpp
+++ b/src/quick/handlers/qquickhandlerpoint.cpp
@@ -92,6 +92,7 @@ void QQuickHandlerPoint::reset()
m_pressure = 0;
m_ellipseDiameters = QSizeF();
m_pressedButtons = Qt::NoButton;
+ m_pressedModifiers = Qt::NoModifier;
}
void QQuickHandlerPoint::reset(const QQuickEventPoint *point)
@@ -111,6 +112,7 @@ void QQuickHandlerPoint::reset(const QQuickEventPoint *point)
m_pressedButtons = event->buttons();
break;
}
+ m_pressedModifiers = event->modifiers();
if (event->asPointerTouchEvent()) {
const QQuickEventTouchPoint *tp = static_cast<const QQuickEventTouchPoint *>(point);
m_uniqueId = tp->uniqueId();
@@ -164,6 +166,7 @@ void QQuickHandlerPoint::reset(const QVector<QQuickEventPoint *> &points)
m_id = 0;
m_uniqueId = QPointingDeviceUniqueId();
m_pressedButtons = event->buttons();
+ m_pressedModifiers = event->modifiers();
m_position = posSum / points.size();
m_scenePosition = scenePosSum / points.size();
if (press) {
@@ -273,6 +276,17 @@ void QQuickHandlerPoint::reset(const QVector<QQuickEventPoint *> &points)
/*!
\readonly
+ \qmlproperty enum QtQuick::HandlerPoint::modifiers
+ \brief Which modifier keys are currently pressed
+
+ This property holds the keyboard modifiers that were pressed at the time
+ the event occurred.
+
+ \sa MouseArea::modifiers
+*/
+
+/*!
+ \readonly
\qmlproperty QVector2D QtQuick::HandlerPoint::velocity
\brief A vector representing the average speed and direction of movement