diff options
author | Shawn Rutledge <[email protected]> | 2021-07-14 13:16:13 +0200 |
---|---|---|
committer | Volker Hilsheimer <[email protected]> | 2021-07-15 17:32:29 +0000 |
commit | 1e9e6c6e70a213cb0ba4e58049b7ad48aef8e48b (patch) | |
tree | aff0ec851b18ff8cb0e841c86da310e9f25bfdf4 /src/gui/kernel/qevent.cpp | |
parent | 0c2125458a9fdddaf3385b257ba4350da872a1d1 (diff) |
Add note about precision of QNativeGestureEvent::delta; fix in Qt 7
We keep QVector2D storage Qt 6 BC (to avoid making QNativeGestureEvent
larger), but in Qt 7 we should return exactly the same value as given
(for what it's worth, in spite of this being overkill for panning a
reasonable distance).
Change-Id: Iecbd4c9b60ad9ae5e0466c7027b038ddb85b8c8b
Pick-to: 6.2
Reviewed-by: Volker Hilsheimer <[email protected]>
Diffstat (limited to 'src/gui/kernel/qevent.cpp')
-rw-r--r-- | src/gui/kernel/qevent.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index f7532d4481c..73a591f34ca 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 } |