From 83729ad7a1e2d9c75ddf7238ab7c91b514dcebcf Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Tue, 12 Sep 2017 16:39:56 +0200 Subject: make the QTouchDevice available in each QNativeGestureEvent MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit QtQuick is beginning to have a use for this, to distinguish native gestures which come from actual trackpad rather than from the "core pointer". It might as well use a real device ID instead of making one up, as it has to do for the core pointer. So far on macOS, the device ID isn't a real one; but that can be fixed, as the qCDebug lines demonstrate (different trackpads have different IDs). Change-Id: I5841deb1c4cc0b77a3b1df70904f70b3d2d71853 Reviewed-by: Shawn Rutledge Reviewed-by: Jan Arve Sæther --- src/gui/kernel/qevent.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/gui/kernel/qevent.h') diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h index b8f86acd75..e439b0ca54 100644 --- a/src/gui/kernel/qevent.h +++ b/src/gui/kernel/qevent.h @@ -301,7 +301,7 @@ protected: class Q_GUI_EXPORT QNativeGestureEvent : public QInputEvent { public: - QNativeGestureEvent(Qt::NativeGestureType type, const QPointF &localPos, const QPointF &windowPos, + QNativeGestureEvent(Qt::NativeGestureType type, const QTouchDevice *dev, const QPointF &localPos, const QPointF &windowPos, const QPointF &screenPos, qreal value, ulong sequenceId, quint64 intArgument); Qt::NativeGestureType gestureType() const { return mGestureType; } qreal value() const { return mRealValue; } @@ -314,8 +314,12 @@ public: const QPointF &windowPos() const { return mWindowPos; } const QPointF &screenPos() const { return mScreenPos; } + const QTouchDevice *device() const; + protected: Qt::NativeGestureType mGestureType; + quint8 mTouchDeviceId; // QTouchDevicePrivate::id + quint8 mReserved[3]; // if qreal == double clang will pad the QPointF below to a 8-byte boundary QPointF mLocalPos; QPointF mWindowPos; QPointF mScreenPos; -- cgit v1.2.3 From ce019efb5cfcc0bce516a761be4295c568994a31 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Fri, 22 Sep 2017 09:42:48 +0200 Subject: add back the device-less QNativeGestureEvent (deprecated) It was an oversight in 83729ad7a1e2d9c75ddf7238ab7c91b514dcebcf that this constructor is still in use in other modules. And in fact we cannot remove public constructors without deprecating them first. Task-number: QTBUG-63355 Change-Id: I64dbf9bc54c0bf6be7157f047b548d3b2c5bc2ed Reviewed-by: Simon Hausmann --- src/gui/kernel/qevent.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/gui/kernel/qevent.h') diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h index e439b0ca54..a6f97a21dc 100644 --- a/src/gui/kernel/qevent.h +++ b/src/gui/kernel/qevent.h @@ -301,6 +301,10 @@ protected: class Q_GUI_EXPORT QNativeGestureEvent : public QInputEvent { public: +#if QT_DEPRECATED_SINCE(5, 10) + QT_DEPRECATED QNativeGestureEvent(Qt::NativeGestureType type, const QPointF &localPos, const QPointF &windowPos, + const QPointF &screenPos, qreal value, ulong sequenceId, quint64 intArgument); +#endif QNativeGestureEvent(Qt::NativeGestureType type, const QTouchDevice *dev, const QPointF &localPos, const QPointF &windowPos, const QPointF &screenPos, qreal value, ulong sequenceId, quint64 intArgument); Qt::NativeGestureType gestureType() const { return mGestureType; } -- cgit v1.2.3