From 7f80c47758ce5d3a2ed9f8c1e5c61644931672c2 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Mon, 10 Oct 2022 17:49:47 +0300 Subject: [PATCH] Port SwitchEvent from QInputEvent Otherwise we need to pass a QInputDevice. --- src/input_event.cpp | 4 ++-- src/input_event.h | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/input_event.cpp b/src/input_event.cpp index 85184bf9c3..4523f40938 100644 --- a/src/input_event.cpp +++ b/src/input_event.cpp @@ -46,12 +46,12 @@ KeyEvent::KeyEvent(QEvent::Type type, Qt::Key key, Qt::KeyboardModifiers modifie } SwitchEvent::SwitchEvent(State state, quint32 timestamp, quint64 timestampMicroseconds, InputDevice *device) - : QInputEvent(QEvent::User) + : QEvent(QEvent::User) , m_state(state) , m_timestampMicroseconds(timestampMicroseconds) + , m_timestamp(timestamp) , m_device(device) { - setTimestamp(timestamp); } TabletEvent::TabletEvent(Type t, const QPointF &pos, const QPointF &globalPos, diff --git a/src/input_event.h b/src/input_event.h index 7bbaf0bdfc..5a6e2c00cb 100644 --- a/src/input_event.h +++ b/src/input_event.h @@ -153,7 +153,7 @@ private: Qt::KeyboardModifiers m_modifiersRelevantForShortcuts = Qt::KeyboardModifiers(); }; -class SwitchEvent : public QInputEvent +class SwitchEvent : public QEvent { public: enum class State { @@ -167,6 +167,11 @@ public: return m_state; } + quint64 timestamp() const + { + return m_timestamp; + } + quint64 timestampMicroseconds() const { return m_timestampMicroseconds; @@ -180,6 +185,7 @@ public: private: State m_state; quint64 m_timestampMicroseconds; + quint64 m_timestamp; InputDevice *m_device; };