diff options
author | Paul Lemire <paul.lemire@kdab.com> | 2019-10-22 07:53:00 +0200 |
---|---|---|
committer | Paul Lemire <paul.lemire@kdab.com> | 2019-10-22 16:13:37 +0200 |
commit | 7f3bba6e8a4a3bdb36f40a636b76c02902c09d02 (patch) | |
tree | beefcead25a060c6bdbb034bd63e9b6cd48b9543 /src/input/frontend | |
parent | 1e499f548a24482a0809a34767a04c91a940ffe8 (diff) |
QMouseEvent: fix BIC issue following Modifier/Modifiers change
Will have to be done only in Qt6 unfortunately. For now we abused
the fact that an int is used to store the enum so that we store
multiple Modifiers values into one Modifiers enum.
Change-Id: Ib111140afbe07cfd62fcf3cb8e1a57d3ad848a89
Reviewed-by: Mike Krus <mike.krus@kdab.com>
Diffstat (limited to 'src/input/frontend')
-rw-r--r-- | src/input/frontend/qmouseevent.cpp | 6 | ||||
-rw-r--r-- | src/input/frontend/qmouseevent.h | 15 |
2 files changed, 10 insertions, 11 deletions
diff --git a/src/input/frontend/qmouseevent.cpp b/src/input/frontend/qmouseevent.cpp index 2033eed36..2b06c824d 100644 --- a/src/input/frontend/qmouseevent.cpp +++ b/src/input/frontend/qmouseevent.cpp @@ -49,7 +49,7 @@ template<typename EventClass, typename QtEventClass> typename EventClass::Modifiers modifiersForEvent(const QtEventClass &event) { const Qt::KeyboardModifiers eventModifiers = event.modifiers(); - typename EventClass::Modifiers modifiers = EventClass::NoModifier; + int modifiers = EventClass::NoModifier; if (eventModifiers & Qt::ShiftModifier) modifiers |= EventClass::ShiftModifier; @@ -66,7 +66,9 @@ typename EventClass::Modifiers modifiersForEvent(const QtEventClass &event) if (eventModifiers & Qt::KeypadModifier) modifiers |= EventClass::KeypadModifier; - return modifiers; + // Abuse the int used to store an enum to store multiple + // modifiers into one + return static_cast<typename EventClass::Modifiers>(modifiers); } } // anonymous diff --git a/src/input/frontend/qmouseevent.h b/src/input/frontend/qmouseevent.h index 1402d8210..ae44d9365 100644 --- a/src/input/frontend/qmouseevent.h +++ b/src/input/frontend/qmouseevent.h @@ -70,7 +70,7 @@ public: }; Q_ENUM(Buttons) // LCOV_EXCL_LINE - enum Modifier { + enum Modifiers { NoModifier = Qt::NoModifier, ShiftModifier = Qt::ShiftModifier, ControlModifier = Qt::ControlModifier, @@ -78,8 +78,8 @@ public: MetaModifier = Qt::MetaModifier, KeypadModifier = Qt::KeypadModifier }; - Q_DECLARE_FLAGS(Modifiers, Modifier) - Q_FLAG(Modifiers) + Q_ENUM(Modifiers) // LCOV_EXCL_LINE + // TO DO Qt6 Modifiers -> Modifier and add Q_FLAG(Modifiers) explicit QMouseEvent(const QT_PREPEND_NAMESPACE(QMouseEvent) &e); ~QMouseEvent(); @@ -128,7 +128,7 @@ public: }; Q_ENUM(Buttons) // LCOV_EXCL_LINE - enum Modifier { + enum Modifiers { NoModifier = Qt::NoModifier, ShiftModifier = Qt::ShiftModifier, ControlModifier = Qt::ControlModifier, @@ -136,8 +136,8 @@ public: MetaModifier = Qt::MetaModifier, KeypadModifier = Qt::KeypadModifier }; - Q_DECLARE_FLAGS(Modifiers, Modifier) - Q_FLAG(Modifiers) + Q_ENUM(Modifiers) // LCOV_EXCL_LINE + // TO DO Qt6 Modifiers -> Modifier and add Q_FLAG(Modifiers) explicit QWheelEvent(const QT_PREPEND_NAMESPACE(QWheelEvent) &e); ~QWheelEvent(); @@ -161,9 +161,6 @@ typedef QSharedPointer<QWheelEvent> QWheelEventPtr; } // namespace Qt3DInput -Q_DECLARE_OPERATORS_FOR_FLAGS(Qt3DInput::QMouseEvent::Modifiers) -Q_DECLARE_OPERATORS_FOR_FLAGS(Qt3DInput::QWheelEvent::Modifiers) - QT_END_NAMESPACE Q_DECLARE_METATYPE(Qt3DInput::QMouseEvent*) // LCOV_EXCL_LINE |