diff options
author | Stephan Binner <stephan.binner@basyskom.com> | 2017-04-20 10:30:24 +0200 |
---|---|---|
committer | Sean Harmer <sean.harmer@kdab.com> | 2017-04-27 11:08:45 +0000 |
commit | 9b478e9179522315ea53fe10ec1278a1f77753f8 (patch) | |
tree | 2beb18c8d2493b636842db4e4093bd0d8da1bcf4 /src/input | |
parent | 7a79da942468621c58251f6daca1a00ca99d970a (diff) |
Fix build for -no-feature-wheelevent
Change-Id: I72591f43c0e2c4cc6e3e589f8d8e52fbb1041666
Reviewed-by: Kevin Ottens <kevin.ottens@kdab.com>
Reviewed-by: Tasuku Suzuki <tasuku.suzuki@qt.io>
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/input')
-rw-r--r-- | src/input/backend/inputhandler.cpp | 20 | ||||
-rw-r--r-- | src/input/backend/inputhandler_p.h | 4 | ||||
-rw-r--r-- | src/input/backend/mousedevice.cpp | 2 | ||||
-rw-r--r-- | src/input/backend/mousedevice_p.h | 2 | ||||
-rw-r--r-- | src/input/backend/mouseeventdispatcherjob.cpp | 11 | ||||
-rw-r--r-- | src/input/backend/mouseeventdispatcherjob_p.h | 9 | ||||
-rw-r--r-- | src/input/backend/mouseeventfilter.cpp | 2 | ||||
-rw-r--r-- | src/input/backend/mousehandler.cpp | 2 | ||||
-rw-r--r-- | src/input/backend/mousehandler_p.h | 2 | ||||
-rw-r--r-- | src/input/frontend/qmouseevent.cpp | 2 | ||||
-rw-r--r-- | src/input/frontend/qmouseevent.h | 5 | ||||
-rw-r--r-- | src/input/frontend/qmousehandler.cpp | 2 | ||||
-rw-r--r-- | src/input/frontend/qmousehandler.h | 2 |
13 files changed, 57 insertions, 8 deletions
diff --git a/src/input/backend/inputhandler.cpp b/src/input/backend/inputhandler.cpp index 985d67470..525a45b6c 100644 --- a/src/input/backend/inputhandler.cpp +++ b/src/input/backend/inputhandler.cpp @@ -163,6 +163,7 @@ void InputHandler::clearPendingMouseEvents() m_pendingMouseEvents.clear(); } +#if QT_CONFIG(wheelevent) void InputHandler::appendWheelEvent(const QT_PREPEND_NAMESPACE(QWheelEvent) &event) { QMutexLocker lock(&m_mutex); @@ -180,7 +181,7 @@ void InputHandler::clearPendingWheelEvents() QMutexLocker lock(&m_mutex); m_pendingWheelEvents.clear(); } - +#endif void InputHandler::appendKeyboardDevice(HKeyboardDevice device) { @@ -249,15 +250,23 @@ QVector<Qt3DCore::QAspectJobPtr> InputHandler::mouseJobs() { QVector<QAspectJobPtr> jobs; const QList<QT_PREPEND_NAMESPACE(QMouseEvent)> mouseEvents = pendingMouseEvents(); +#if QT_CONFIG(wheelevent) const QList<QT_PREPEND_NAMESPACE(QWheelEvent)> wheelEvents = pendingWheelEvents(); +#endif for (const HMouseDevice cHandle : qAsConst(m_activeMouseDevices)) { MouseDevice *controller = m_mouseDeviceManager->data(cHandle); controller->updateMouseEvents(mouseEvents); +#if QT_CONFIG(wheelevent) controller->updateWheelEvents(wheelEvents); +#endif // Event dispacthing job - if (!mouseEvents.isEmpty() || !wheelEvents.empty()) { + if (!mouseEvents.isEmpty() +#if QT_CONFIG(wheelevent) + || !wheelEvents.empty() +#endif + ) { // Send the events to the mouse handlers that have for sourceDevice controller const QVector<HMouseHandler> activeMouseHandlers = m_mouseInputManager->activeHandles(); for (HMouseHandler mouseHandlerHandle : activeMouseHandlers) { @@ -267,8 +276,11 @@ QVector<Qt3DCore::QAspectJobPtr> InputHandler::mouseJobs() if (mouseHandler->mouseDevice() == controller->peerId()) { MouseEventDispatcherJob *job = new MouseEventDispatcherJob(mouseHandler->peerId(), - mouseEvents, - wheelEvents); + mouseEvents +#if QT_CONFIG(wheelevent) + , wheelEvents +#endif + ); job->setInputHandler(this); jobs.append(QAspectJobPtr(job)); } diff --git a/src/input/backend/inputhandler_p.h b/src/input/backend/inputhandler_p.h index e80441f1a..a2a38262d 100644 --- a/src/input/backend/inputhandler_p.h +++ b/src/input/backend/inputhandler_p.h @@ -127,9 +127,11 @@ public: QList<QT_PREPEND_NAMESPACE(QMouseEvent)> pendingMouseEvents(); void clearPendingMouseEvents(); +#if QT_CONFIG(wheelevent) void appendWheelEvent(const QT_PREPEND_NAMESPACE(QWheelEvent) &event); QList<QT_PREPEND_NAMESPACE(QWheelEvent)> pendingWheelEvents(); void clearPendingWheelEvents(); +#endif void appendKeyboardDevice(HKeyboardDevice device); void removeKeyboardDevice(HKeyboardDevice device); @@ -170,7 +172,9 @@ private: QList<QT_PREPEND_NAMESPACE(QKeyEvent)> m_pendingKeyEvents; QList<QT_PREPEND_NAMESPACE(QMouseEvent)> m_pendingMouseEvents; +#if QT_CONFIG(wheelevent) QList<QT_PREPEND_NAMESPACE(QWheelEvent)> m_pendingWheelEvents; +#endif mutable QMutex m_mutex; AxisManager *m_axisManager; diff --git a/src/input/backend/mousedevice.cpp b/src/input/backend/mousedevice.cpp index 1d329252d..128988637 100644 --- a/src/input/backend/mousedevice.cpp +++ b/src/input/backend/mousedevice.cpp @@ -135,6 +135,7 @@ float MouseDevice::sensitivity() const return m_sensitivity; } +#if QT_CONFIG(wheelevent) void MouseDevice::updateWheelEvents(const QList<QT_PREPEND_NAMESPACE (QWheelEvent)> &events) { // Reset axis values before we accumulate new values for this frame @@ -147,6 +148,7 @@ void MouseDevice::updateWheelEvents(const QList<QT_PREPEND_NAMESPACE (QWheelEven } } } +#endif void MouseDevice::updateMouseEvents(const QList<QT_PREPEND_NAMESPACE(QMouseEvent)> &events) { diff --git a/src/input/backend/mousedevice_p.h b/src/input/backend/mousedevice_p.h index 0b95c6183..a085194ff 100644 --- a/src/input/backend/mousedevice_p.h +++ b/src/input/backend/mousedevice_p.h @@ -99,7 +99,9 @@ public: bool isButtonPressed(int buttonIdentifier) const Q_DECL_OVERRIDE; void updateMouseEvents(const QList<QT_PREPEND_NAMESPACE(QMouseEvent)> &events); +#if QT_CONFIG(wheelevent) void updateWheelEvents(const QList<QT_PREPEND_NAMESPACE(QWheelEvent)> &events); +#endif MouseState mouseState() const; QPointF previousPos() const; diff --git a/src/input/backend/mouseeventdispatcherjob.cpp b/src/input/backend/mouseeventdispatcherjob.cpp index 77eb69712..11653d8a8 100644 --- a/src/input/backend/mouseeventdispatcherjob.cpp +++ b/src/input/backend/mouseeventdispatcherjob.cpp @@ -50,13 +50,18 @@ namespace Qt3DInput { namespace Input { MouseEventDispatcherJob::MouseEventDispatcherJob(Qt3DCore::QNodeId input, - const QList<QT_PREPEND_NAMESPACE (QMouseEvent)> &mouseEvents, - const QList<QT_PREPEND_NAMESPACE (QWheelEvent)> &wheelEvents) + const QList<QT_PREPEND_NAMESPACE (QMouseEvent)> &mouseEvents +#if QT_CONFIG(wheelevent) + , const QList<QT_PREPEND_NAMESPACE (QWheelEvent)> &wheelEvents +#endif + ) : QAspectJob() , m_inputHandler(nullptr) , m_mouseInput(input) , m_mouseEvents(mouseEvents) +#if QT_CONFIG(wheelevent) , m_wheelEvents(wheelEvents) +#endif { SET_JOB_RUN_STAT_TYPE(this, JobTypes::MouseEventDispatcher, 0); } @@ -73,8 +78,10 @@ void MouseEventDispatcherJob::run() // Send mouse and wheel events to frontend for (const QT_PREPEND_NAMESPACE(QMouseEvent) &e : m_mouseEvents) input->mouseEvent(QMouseEventPtr(new QMouseEvent(e))); +#if QT_CONFIG(wheelevent) for (const QT_PREPEND_NAMESPACE(QWheelEvent) &e : m_wheelEvents) input->wheelEvent(QWheelEventPtr(new QWheelEvent(e))); +#endif } } diff --git a/src/input/backend/mouseeventdispatcherjob_p.h b/src/input/backend/mouseeventdispatcherjob_p.h index ebf1538e4..366774005 100644 --- a/src/input/backend/mouseeventdispatcherjob_p.h +++ b/src/input/backend/mouseeventdispatcherjob_p.h @@ -66,8 +66,11 @@ class MouseEventDispatcherJob : public Qt3DCore::QAspectJob { public: explicit MouseEventDispatcherJob(Qt3DCore::QNodeId input, - const QList<QT_PREPEND_NAMESPACE(QMouseEvent)> &mouseEvents, - const QList<QT_PREPEND_NAMESPACE(QWheelEvent)> &wheelEvents); + const QList<QT_PREPEND_NAMESPACE(QMouseEvent)> &mouseEvents +#if QT_CONFIG(wheelevent) + , const QList<QT_PREPEND_NAMESPACE(QWheelEvent)> &wheelEvents +#endif + ); void setInputHandler(InputHandler *handler); void run() Q_DECL_FINAL; @@ -75,7 +78,9 @@ private: InputHandler *m_inputHandler; const Qt3DCore::QNodeId m_mouseInput; const QList<QT_PREPEND_NAMESPACE(QMouseEvent)> m_mouseEvents; +#if QT_CONFIG(wheelevent) const QList<QT_PREPEND_NAMESPACE(QWheelEvent)> m_wheelEvents; +#endif }; } // namespace Input diff --git a/src/input/backend/mouseeventfilter.cpp b/src/input/backend/mouseeventfilter.cpp index bc2473a33..618a64b15 100644 --- a/src/input/backend/mouseeventfilter.cpp +++ b/src/input/backend/mouseeventfilter.cpp @@ -80,10 +80,12 @@ bool MouseEventFilter::eventFilter(QObject *obj, QEvent *e) // Creates copy and store event to be processed later on in an InputAspect job m_inputHandler->appendMouseEvent(QMouseEvent(*static_cast<QMouseEvent *>(e))); break; +#if QT_CONFIG(wheelevent) case QEvent::Wheel: // Creates copy and store event to be processed later on in an InputAspect job m_inputHandler->appendWheelEvent(QWheelEvent(*static_cast<QWheelEvent *>(e))); break; +#endif default: break; } diff --git a/src/input/backend/mousehandler.cpp b/src/input/backend/mousehandler.cpp index a0619aaf2..c492dcf28 100644 --- a/src/input/backend/mousehandler.cpp +++ b/src/input/backend/mousehandler.cpp @@ -91,6 +91,7 @@ void MouseHandler::mouseEvent(const QMouseEventPtr &event) notifyObservers(e); } +#if QT_CONFIG(wheelevent) void MouseHandler::wheelEvent(const QWheelEventPtr &event) { auto e = Qt3DCore::QPropertyUpdatedChangePtr::create(peerId()); @@ -99,6 +100,7 @@ void MouseHandler::wheelEvent(const QWheelEventPtr &event) e->setValue(QVariant::fromValue(event)); notifyObservers(e); } +#endif void MouseHandler::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) { diff --git a/src/input/backend/mousehandler_p.h b/src/input/backend/mousehandler_p.h index 867764017..ae484d8d6 100644 --- a/src/input/backend/mousehandler_p.h +++ b/src/input/backend/mousehandler_p.h @@ -70,7 +70,9 @@ public: Qt3DCore::QNodeId mouseDevice() const; void setInputHandler(InputHandler *handler); void mouseEvent(const QMouseEventPtr &event); +#if QT_CONFIG(wheelevent) void wheelEvent(const QWheelEventPtr &event); +#endif protected: void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE; diff --git a/src/input/frontend/qmouseevent.cpp b/src/input/frontend/qmouseevent.cpp index b1574f623..62f7a097e 100644 --- a/src/input/frontend/qmouseevent.cpp +++ b/src/input/frontend/qmouseevent.cpp @@ -455,6 +455,7 @@ QMouseEvent::Modifiers QMouseEvent::modifiers() const * Returns the QEvent::Type of the event. */ +#if QT_CONFIG(wheelevent) /*! * Constructs a new QWheelEvent instance from the QWheelEvent \a e. */ @@ -497,6 +498,7 @@ QWheelEvent::Modifiers QWheelEvent::modifiers() const return QWheelEvent::NoModifier; } } +#endif // QT_CONFIG(wheelevent) } // namespace Qt3DInput diff --git a/src/input/frontend/qmouseevent.h b/src/input/frontend/qmouseevent.h index de11c84a2..63786ac28 100644 --- a/src/input/frontend/qmouseevent.h +++ b/src/input/frontend/qmouseevent.h @@ -106,6 +106,7 @@ private: typedef QSharedPointer<QMouseEvent> QMouseEventPtr; +#if QT_CONFIG(wheelevent) class QT3DINPUTSHARED_EXPORT QWheelEvent : public QObject { Q_OBJECT @@ -154,12 +155,16 @@ private: }; typedef QSharedPointer<QWheelEvent> QWheelEventPtr; +#endif } // namespace Qt3DInput QT_END_NAMESPACE Q_DECLARE_METATYPE(Qt3DInput::QMouseEvent*) // LCOV_EXCL_LINE + +#if QT_CONFIG(wheelevent) Q_DECLARE_METATYPE(Qt3DInput::QWheelEvent*) // LCOV_EXCL_LINE +#endif #endif // QT3DINPUT_QMOUSEEVENT_H diff --git a/src/input/frontend/qmousehandler.cpp b/src/input/frontend/qmousehandler.cpp index fef56810c..419052d8a 100644 --- a/src/input/frontend/qmousehandler.cpp +++ b/src/input/frontend/qmousehandler.cpp @@ -313,9 +313,11 @@ void QMouseHandler::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) if (e->propertyName() == QByteArrayLiteral("mouse")) { QMouseEventPtr ev = e->value().value<QMouseEventPtr>(); d->mouseEvent(ev); +#if QT_CONFIG(wheelevent) } else if (e->propertyName() == QByteArrayLiteral("wheel")) { QWheelEventPtr ev = e->value().value<QWheelEventPtr>(); emit wheel(ev.data()); +#endif } } } diff --git a/src/input/frontend/qmousehandler.h b/src/input/frontend/qmousehandler.h index 750ed394d..ef4267c5c 100644 --- a/src/input/frontend/qmousehandler.h +++ b/src/input/frontend/qmousehandler.h @@ -82,7 +82,9 @@ Q_SIGNALS: void pressAndHold(Qt3DInput::QMouseEvent *mouse); void positionChanged(Qt3DInput::QMouseEvent *mouse); +#if QT_CONFIG(wheelevent) void wheel(Qt3DInput::QWheelEvent *wheel); +#endif protected: void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) Q_DECL_OVERRIDE; |