| 1 | // Copyright (C) 2016 The Qt Company Ltd. |
| 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 QROTATIONSENSOR_H |
| 5 | #define QROTATIONSENSOR_H |
| 6 | |
| 7 | #include <QtSensors/qsensor.h> |
| 8 | |
| 9 | QT_BEGIN_NAMESPACE |
| 10 | |
| 11 | class QRotationReadingPrivate; |
| 12 | |
| 13 | class Q_SENSORS_EXPORT QRotationReading : public QSensorReading |
| 14 | { |
| 15 | Q_OBJECT |
| 16 | Q_PROPERTY(qreal x READ x) |
| 17 | Q_PROPERTY(qreal y READ y) |
| 18 | Q_PROPERTY(qreal z READ z) |
| 19 | DECLARE_READING(QRotationReading) |
| 20 | public: |
| 21 | qreal x() const; |
| 22 | qreal y() const; |
| 23 | qreal z() const; |
| 24 | |
| 25 | void setFromEuler(qreal x, qreal y, qreal z); |
| 26 | }; |
| 27 | |
| 28 | class Q_SENSORS_EXPORT QRotationFilter : public QSensorFilter |
| 29 | { |
| 30 | public: |
| 31 | virtual bool filter(QRotationReading *reading) = 0; |
| 32 | private: |
| 33 | bool filter(QSensorReading *reading) override; |
| 34 | }; |
| 35 | |
| 36 | class QRotationSensorPrivate; |
| 37 | |
| 38 | class Q_SENSORS_EXPORT QRotationSensor : public QSensor |
| 39 | { |
| 40 | Q_OBJECT |
| 41 | Q_PROPERTY(bool hasZ READ hasZ NOTIFY hasZChanged) |
| 42 | public: |
| 43 | explicit QRotationSensor(QObject *parent = nullptr); |
| 44 | virtual ~QRotationSensor(); |
| 45 | QRotationReading *reading() const; |
| 46 | static char const * const sensorType; |
| 47 | |
| 48 | bool hasZ() const; |
| 49 | void setHasZ(bool hasZ); |
| 50 | |
| 51 | Q_SIGNALS: |
| 52 | void hasZChanged(bool hasZ); |
| 53 | |
| 54 | private: |
| 55 | Q_DECLARE_PRIVATE(QRotationSensor) |
| 56 | Q_DISABLE_COPY(QRotationSensor) |
| 57 | }; |
| 58 | |
| 59 | QT_END_NAMESPACE |
| 60 | |
| 61 | #endif |
| 62 | |
| 63 | |