diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2017-09-12 16:39:56 +0200 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2017-09-21 16:35:06 +0000 |
commit | 83729ad7a1e2d9c75ddf7238ab7c91b514dcebcf (patch) | |
tree | cf03640a9045bb1737d36eeb28e86f18175e6bad /src/gui/kernel/qtouchdevice.cpp | |
parent | be0a9a76885bee3eaee58734f8964e455c03be5d (diff) |
make the QTouchDevice available in each QNativeGestureEvent
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 <shawn.rutledge@qt.io>
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Diffstat (limited to 'src/gui/kernel/qtouchdevice.cpp')
-rw-r--r-- | src/gui/kernel/qtouchdevice.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/gui/kernel/qtouchdevice.cpp b/src/gui/kernel/qtouchdevice.cpp index 0f13412fb1..511e92566e 100644 --- a/src/gui/kernel/qtouchdevice.cpp +++ b/src/gui/kernel/qtouchdevice.cpp @@ -235,6 +235,15 @@ bool QTouchDevicePrivate::isRegistered(const QTouchDevice *dev) return deviceList()->contains(dev); } +const QTouchDevice *QTouchDevicePrivate::deviceById(quint8 id) +{ + QMutexLocker locker(&devicesMutex); + for (const QTouchDevice *dev : *deviceList()) + if (QTouchDevicePrivate::get(const_cast<QTouchDevice *>(dev))->id == id) + return dev; + return nullptr; +} + /*! \internal */ |