| 1 | // Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB). |
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | |
| 4 | #ifndef QT3DINPUT_QMOUSEDEVICE_H |
| 5 | #define QT3DINPUT_QMOUSEDEVICE_H |
| 6 | |
| 7 | #include <Qt3DInput/qabstractphysicaldevice.h> |
| 8 | #include <Qt3DInput/qt3dinput_global.h> |
| 9 | |
| 10 | QT_BEGIN_NAMESPACE |
| 11 | |
| 12 | namespace Qt3DInput { |
| 13 | |
| 14 | class QMouseDevicePrivate; |
| 15 | class QMouseInput; |
| 16 | |
| 17 | class Q_3DINPUTSHARED_EXPORT QMouseDevice : public Qt3DInput::QAbstractPhysicalDevice |
| 18 | { |
| 19 | Q_OBJECT |
| 20 | Q_PROPERTY(float sensitivity READ sensitivity WRITE setSensitivity NOTIFY sensitivityChanged) |
| 21 | Q_PROPERTY(bool updateAxesContinuously READ updateAxesContinuously WRITE setUpdateAxesContinuously NOTIFY updateAxesContinuouslyChanged REVISION 15) |
| 22 | public: |
| 23 | explicit QMouseDevice(Qt3DCore::QNode *parent = nullptr); |
| 24 | ~QMouseDevice(); |
| 25 | |
| 26 | enum Axis { |
| 27 | X, |
| 28 | Y, |
| 29 | WheelX, |
| 30 | WheelY |
| 31 | }; |
| 32 | Q_ENUM(Axis) // LCOV_EXCL_LINE |
| 33 | |
| 34 | int axisCount() const final; |
| 35 | int buttonCount() const final; |
| 36 | QStringList axisNames() const final; |
| 37 | QStringList buttonNames() const final; |
| 38 | int axisIdentifier(const QString &name) const final; |
| 39 | int buttonIdentifier(const QString &name) const final; |
| 40 | |
| 41 | float sensitivity() const; |
| 42 | bool updateAxesContinuously() const; |
| 43 | |
| 44 | public Q_SLOTS: |
| 45 | void setSensitivity(float value); |
| 46 | void setUpdateAxesContinuously(bool updateAxesContinuously); |
| 47 | |
| 48 | Q_SIGNALS: |
| 49 | void sensitivityChanged(float value); |
| 50 | void updateAxesContinuouslyChanged(bool updateAxesContinuously); |
| 51 | |
| 52 | private: |
| 53 | Q_DECLARE_PRIVATE(QMouseDevice) |
| 54 | }; |
| 55 | |
| 56 | } // namespace Qt3DInput |
| 57 | |
| 58 | QT_END_NAMESPACE |
| 59 | |
| 60 | Q_DECLARE_METATYPE(Qt3DInput::QMouseDevice*) // LCOV_EXCL_LINE |
| 61 | |
| 62 | #endif // QT3DINPUT_QMOUSEDEVICE_H |
| 63 | |