From 92a9778026e2cfb26281df9ac020eb6799ea2f7e Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 22 Aug 2019 10:38:50 +0200 Subject: [PATCH] QNativeGestureEvent: clean up for Qt 6 Make the touch device a member instead of holding it in a static QHash, indexed by event address. Change-Id: I21588ede2ebdde70eea2844ded2fb880700b92fb Reviewed-by: Friedemann Kleint --- src/gui/kernel/qevent.cpp | 17 +++-------------- src/gui/kernel/qevent.h | 3 ++- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index ec527910101..96f61e7ae95 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -2686,10 +2686,6 @@ QNativeGestureEvent::QNativeGestureEvent(Qt::NativeGestureType type, const QPoin { } #endif -typedef QHash NativeGestureEventDataHash; -// ### Qt6: move this to a member in QNativeGestureEvent -Q_GLOBAL_STATIC(NativeGestureEventDataHash, g_nativeGestureEventDataHash) - /*! Constructs a native gesture event of type \a type originating from \a device. @@ -2704,27 +2700,20 @@ QNativeGestureEvent::QNativeGestureEvent(Qt::NativeGestureType type, const QTouc const QPointF &screenPos, qreal realValue, ulong sequenceId, quint64 intValue) : QInputEvent(QEvent::NativeGesture), mGestureType(type), mLocalPos(localPos), mWindowPos(windowPos), mScreenPos(screenPos), mRealValue(realValue), - mSequenceId(sequenceId), mIntValue(intValue) + mSequenceId(sequenceId), mIntValue(intValue), mDevice(device) { - g_nativeGestureEventDataHash->insert(this, device); } QNativeGestureEvent::~QNativeGestureEvent() -{ - g_nativeGestureEventDataHash->remove(this); -} + = default; /*! + \fn const QTouchDevice *QNativeGestureEvent::device() const \since 5.10 Returns the device. */ -const QTouchDevice *QNativeGestureEvent::device() const -{ - return g_nativeGestureEventDataHash->value(this); -} - /*! \fn QNativeGestureEvent::gestureType() const \since 5.2 diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h index b73d90529a4..10ef01fa1d0 100644 --- a/src/gui/kernel/qevent.h +++ b/src/gui/kernel/qevent.h @@ -350,7 +350,7 @@ public: const QPointF &windowPos() const { return mWindowPos; } const QPointF &screenPos() const { return mScreenPos; } - const QTouchDevice *device() const; + const QTouchDevice *device() const { return mDevice; } protected: Qt::NativeGestureType mGestureType; @@ -360,6 +360,7 @@ protected: qreal mRealValue; ulong mSequenceId; quint64 mIntValue; + const QTouchDevice *mDevice; }; #endif // QT_NO_GESTURES