Port SwitchEvent from QInputEvent

Otherwise we need to pass a QInputDevice.
This commit is contained in:
Vlad Zahorodnii 2022-10-10 17:49:47 +03:00
parent c147340878
commit 7f80c47758
2 changed files with 9 additions and 3 deletions

View file

@ -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) SwitchEvent::SwitchEvent(State state, quint32 timestamp, quint64 timestampMicroseconds, InputDevice *device)
: QInputEvent(QEvent::User) : QEvent(QEvent::User)
, m_state(state) , m_state(state)
, m_timestampMicroseconds(timestampMicroseconds) , m_timestampMicroseconds(timestampMicroseconds)
, m_timestamp(timestamp)
, m_device(device) , m_device(device)
{ {
setTimestamp(timestamp);
} }
TabletEvent::TabletEvent(Type t, const QPointF &pos, const QPointF &globalPos, TabletEvent::TabletEvent(Type t, const QPointF &pos, const QPointF &globalPos,

View file

@ -153,7 +153,7 @@ private:
Qt::KeyboardModifiers m_modifiersRelevantForShortcuts = Qt::KeyboardModifiers(); Qt::KeyboardModifiers m_modifiersRelevantForShortcuts = Qt::KeyboardModifiers();
}; };
class SwitchEvent : public QInputEvent class SwitchEvent : public QEvent
{ {
public: public:
enum class State { enum class State {
@ -167,6 +167,11 @@ public:
return m_state; return m_state;
} }
quint64 timestamp() const
{
return m_timestamp;
}
quint64 timestampMicroseconds() const quint64 timestampMicroseconds() const
{ {
return m_timestampMicroseconds; return m_timestampMicroseconds;
@ -180,6 +185,7 @@ public:
private: private:
State m_state; State m_state;
quint64 m_timestampMicroseconds; quint64 m_timestampMicroseconds;
quint64 m_timestamp;
InputDevice *m_device; InputDevice *m_device;
}; };