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 <volker.hilsheimer@qt.io>bb10
parent
0c2125458a
commit
1e9e6c6e70
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue