diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-10-16 11:50:27 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-10-26 10:14:05 +0200 |
commit | e3470a98e98c8a789a4cb298a0afaacf0cc62ce9 (patch) | |
tree | 346f0960c073bfb87fd2969fc89dc693fab48e96 /src/plugins/platforms/windows/qwindowsmousehandler.h | |
parent | d9edad81177954c89619b6dee70ca76f2f4709ef (diff) |
Windows QPA: Use a QSharedPointer for the touch device
For reasons of symmetry with the tablet devices.
As a drive by, give it more distinct IDs.
Task-number: QTBUG-46412
Change-Id: Ie667621246b26db6fdda84c5ff2455fe38633cb3
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Diffstat (limited to 'src/plugins/platforms/windows/qwindowsmousehandler.h')
-rw-r--r-- | src/plugins/platforms/windows/qwindowsmousehandler.h | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/plugins/platforms/windows/qwindowsmousehandler.h b/src/plugins/platforms/windows/qwindowsmousehandler.h index 0b7f26f6c6..c007cf5a5b 100644 --- a/src/plugins/platforms/windows/qwindowsmousehandler.h +++ b/src/plugins/platforms/windows/qwindowsmousehandler.h @@ -45,6 +45,7 @@ #include <QtCore/qpointer.h> #include <QtCore/qhash.h> +#include <QtCore/qsharedpointer.h> #include <QtGui/qevent.h> QT_BEGIN_NAMESPACE @@ -56,10 +57,12 @@ class QWindowsMouseHandler { Q_DISABLE_COPY_MOVE(QWindowsMouseHandler) public: + using QPointingDevicePtr = QSharedPointer<QPointingDevice>; + QWindowsMouseHandler(); - QPointingDevice *touchDevice() const { return m_touchDevice; } - void setTouchDevice(QPointingDevice *d) { m_touchDevice = d; } + const QPointingDevicePtr &touchDevice() const { return m_touchDevice; } + void setTouchDevice(const QPointingDevicePtr &d) { m_touchDevice = d; } bool translateMouseEvent(QWindow *widget, HWND hwnd, QtWindows::WindowsEventType t, MSG msg, @@ -90,7 +93,7 @@ private: QPointer<QWindow> m_trackedWindow; QHash<DWORD, int> m_touchInputIDToTouchPointID; QHash<int, QPointF> m_lastTouchPositions; - QPointingDevice *m_touchDevice = nullptr; + QPointingDevicePtr m_touchDevice; bool m_leftButtonDown = false; QWindow *m_previousCaptureWindow = nullptr; QEvent::Type m_lastEventType = QEvent::None; |