summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2019-08-22 10:38:50 +0200
committerMarc Mutz <marc.mutz@kdab.com>2019-08-22 11:50:54 +0200
commit92a9778026e2cfb26281df9ac020eb6799ea2f7e (patch)
treed362388ddad50d5884b00d62a8c4f5eba8ccf2ab /src/gui
parent8811e96aac7537bae049860b90adf425042afb31 (diff)
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 <Friedemann.Kleint@qt.io>
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/kernel/qevent.cpp17
-rw-r--r--src/gui/kernel/qevent.h3
2 files changed, 5 insertions, 15 deletions
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp
index ec52791010..96f61e7ae9 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<const QNativeGestureEvent*, const QTouchDevice*> 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 b73d90529a..10ef01fa1d 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