summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gui/kernel/qevent.cpp10
-rw-r--r--src/gui/kernel/qevent.h14
2 files changed, 19 insertions, 5 deletions
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp
index f7532d4481..73a591f34c 100644
--- a/src/gui/kernel/qevent.cpp
+++ b/src/gui/kernel/qevent.cpp
@@ -2837,18 +2837,22 @@ QNativeGestureEvent::QNativeGestureEvent(Qt::NativeGestureType type, const QPoin
indicating that the target item should have its scale adjusted like this:
item.scale = item.scale * (1 + event.value)
- For PanNativeGesture, \a deltas gives the distance in pixels that the
+ For PanNativeGesture, \a delta gives the distance in pixels that the
viewport, widget or item should be moved or panned.
+ \note The \a delta is stored in single precision (QVector2D), so \l delta()
+ may return slightly different values in some cases. This is subject to change
+ in future versions of Qt.
+
\since 6.2
*/
QNativeGestureEvent::QNativeGestureEvent(Qt::NativeGestureType type, const QPointingDevice *device, int fingerCount,
const QPointF &localPos, const QPointF &scenePos,
- const QPointF &globalPos, qreal value, const QPointF &deltas,
+ const QPointF &globalPos, qreal value, const QPointF &delta,
quint64 sequenceId)
: QSinglePointEvent(QEvent::NativeGesture, device, localPos, scenePos, globalPos, Qt::NoButton,
Qt::NoButton, Qt::NoModifier),
- m_sequenceId(sequenceId), m_delta(deltas), m_realValue(value), m_gestureType(type), m_fingerCount(fingerCount)
+ m_sequenceId(sequenceId), m_delta(delta), m_realValue(value), m_gestureType(type), m_fingerCount(fingerCount)
{
Q_ASSERT(fingerCount < 16); // we store it in 4 bits unsigned
}
diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h
index 9796886ae1..9c53f7ce92 100644
--- a/src/gui/kernel/qevent.h
+++ b/src/gui/kernel/qevent.h
@@ -416,7 +416,7 @@ public:
#endif
QNativeGestureEvent(Qt::NativeGestureType type, const QPointingDevice *dev, int fingerCount,
const QPointF &localPos, const QPointF &scenePos, const QPointF &globalPos,
- qreal value, const QPointF &deltas, quint64 sequenceId = UINT64_MAX);
+ qreal value, const QPointF &delta, quint64 sequenceId = UINT64_MAX);
~QNativeGestureEvent();
QNativeGestureEvent *clone() const override { return new QNativeGestureEvent(*this); }
@@ -424,7 +424,13 @@ public:
Qt::NativeGestureType gestureType() const { return m_gestureType; }
int fingerCount() const { return m_fingerCount; }
qreal value() const { return m_realValue; }
- QPointF delta() const { return m_delta.toPointF(); }
+ QPointF delta() const {
+#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
+ return m_delta.toPointF();
+#else
+ return m_delta;
+#endif
+ }
#if QT_DEPRECATED_SINCE(6, 0)
#ifndef QT_NO_INTEGER_EVENT_COORDINATES
@@ -443,7 +449,11 @@ public:
protected:
quint64 m_sequenceId;
+#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
QVector2D m_delta;
+#else
+ QPointF m_delta;
+#endif
qreal m_realValue;
Qt::NativeGestureType m_gestureType;
quint32 m_fingerCount : 4;