Change QNativeGestureEvent::deltas() to QPointF

It came up during 6.2 API review that we prefer all floating-point API
to be double-precision on 64-bit platforms, despite the awkwardness of
representing a displacement vector with something called a "point".
The docs for QPointF explicitly state "A QPointF object can also be used
as a vector: Addition and subtraction are defined..."

Amends 31f90e99b8

Change-Id: I01029661f2586640cbf846f49df164c176d17f7a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
Shawn Rutledge 2021-07-13 12:49:12 +02:00
parent 1ef8188a08
commit e3aa45006d
5 changed files with 6 additions and 6 deletions

View File

@ -2822,7 +2822,7 @@ QNativeGestureEvent::QNativeGestureEvent(Qt::NativeGestureType type, const QPoin
*/
QNativeGestureEvent::QNativeGestureEvent(Qt::NativeGestureType type, const QPointingDevice *device, int fingerCount,
const QPointF &localPos, const QPointF &scenePos,
const QPointF &globalPos, qreal value, QVector2D deltas,
const QPointF &globalPos, qreal value, const QPointF &deltas,
quint64 sequenceId)
: QSinglePointEvent(QEvent::NativeGesture, device, localPos, scenePos, globalPos, Qt::NoButton,
Qt::NoButton, Qt::NoModifier),

View File

@ -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, QVector2D deltas, quint64 sequenceId = UINT64_MAX);
qreal value, const QPointF &deltas, quint64 sequenceId = UINT64_MAX);
~QNativeGestureEvent();
QNativeGestureEvent *clone() const override { return new QNativeGestureEvent(*this); }
@ -424,7 +424,7 @@ public:
Qt::NativeGestureType gestureType() const { return m_gestureType; }
int fingerCount() const { return m_fingerCount; }
qreal value() const { return m_realValue; }
QVector2D deltas() const { return m_deltas; }
QPointF deltas() const { return m_deltas.toPointF(); }
#if QT_DEPRECATED_SINCE(6, 0)
#ifndef QT_NO_INTEGER_EVENT_COORDINATES

View File

@ -1057,7 +1057,7 @@ bool QWindowSystemInterface::handleGestureEventWithRealValue(QWindow *window, ul
}
bool QWindowSystemInterface::handleGestureEventWithValueAndDeltas(QWindow *window, ulong timestamp, const QPointingDevice *device,
Qt::NativeGestureType type, qreal value, QVector2D deltas,
Qt::NativeGestureType type, qreal value, const QPointF &deltas,
const QPointF &local, const QPointF &global, int fingerCount)
{
QWindowSystemInterfacePrivate::GestureEvent *e =

View File

@ -299,7 +299,7 @@ public:
static bool handleGestureEventWithRealValue(QWindow *window, ulong timestamp, const QPointingDevice *device, Qt::NativeGestureType type,
qreal value, const QPointF &local, const QPointF &global, int fingerCount = 2);
static bool handleGestureEventWithValueAndDeltas(QWindow *window, ulong timestamp, const QPointingDevice *device, Qt::NativeGestureType type, qreal value,
QVector2D deltas, const QPointF &local, const QPointF &global, int fingerCount = 2);
const QPointF &deltas, const QPointF &local, const QPointF &global, int fingerCount = 2);
#endif // QT_NO_GESTURES
static void handlePlatformPanelEvent(QWindow *window);

View File

@ -458,7 +458,7 @@ public:
Qt::NativeGestureType type;
QPointF pos;
QPointF globalPos;
QVector2D deltas;
QPointF deltas;
int fingerCount;
// Mac
qreal realValue;