diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/sensors/accelbubble/accelbubble.qml | 6 | ||||
-rw-r--r-- | examples/sensors/grue/console_app/main.cpp | 2 | ||||
-rw-r--r-- | examples/sensors/grue/import/main.cpp | 2 | ||||
-rw-r--r-- | examples/sensors/grue/lib/gruesensor.h | 2 | ||||
-rw-r--r-- | examples/sensors/grue/plugin/gruesensorimpl.h | 4 | ||||
-rw-r--r-- | examples/sensors/grue/plugin/main.cpp | 6 | ||||
-rw-r--r-- | examples/sensors/maze/Mouse.qml | 4 | ||||
-rw-r--r-- | examples/sensors/qmlsensorgestures/plugin/qcountergestureplugin.h | 6 | ||||
-rw-r--r-- | examples/sensors/qmlsensorgestures/plugin/qcounterrecognizer.h | 10 | ||||
-rw-r--r-- | examples/sensors/sensor_explorer/import/main.cpp | 2 | ||||
-rw-r--r-- | examples/sensors/sensorgestures/sensorgestures.pro | 1 |
11 files changed, 23 insertions, 22 deletions
diff --git a/examples/sensors/accelbubble/accelbubble.qml b/examples/sensors/accelbubble/accelbubble.qml index 37bf4278..8bd036ff 100644 --- a/examples/sensors/accelbubble/accelbubble.qml +++ b/examples/sensors/accelbubble/accelbubble.qml @@ -63,7 +63,7 @@ ApplicationWindow { width: 320 height: 480 visible: true - + readonly property double radians_to_degrees: 180 / Math.PI //! [1] Accelerometer { @@ -101,10 +101,10 @@ ApplicationWindow { } function calcPitch(x,y,z) { - return -(Math.atan(y / Math.sqrt(x * x + z * z)) * 57.2957795); + return -Math.atan2(y, Math.hypot(x, z)) * mainWindow.radians_to_degrees; } function calcRoll(x,y,z) { - return -(Math.atan(x / Math.sqrt(y * y + z * z)) * 57.2957795); + return -Math.atan2(x, Math.hypot(y, z)) * mainWindow.radians_to_degrees; } Image { diff --git a/examples/sensors/grue/console_app/main.cpp b/examples/sensors/grue/console_app/main.cpp index 6eb5d062..29a629b5 100644 --- a/examples/sensors/grue/console_app/main.cpp +++ b/examples/sensors/grue/console_app/main.cpp @@ -61,7 +61,7 @@ public: { } - bool filter(QSensorReading *reading) + bool filter(QSensorReading *reading) override { int percent = reading->property("chanceOfBeingEaten").value<int>(); if (percent == 0) { diff --git a/examples/sensors/grue/import/main.cpp b/examples/sensors/grue/import/main.cpp index b4b6faae..4827af48 100644 --- a/examples/sensors/grue/import/main.cpp +++ b/examples/sensors/grue/import/main.cpp @@ -66,7 +66,7 @@ class GrueSensorQmlImport : public QQmlExtensionPlugin Q_OBJECT Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid FILE "import.json") public: - virtual void registerTypes(const char *uri) + void registerTypes(const char *uri) override { char const * const package = "Grue"; if (QLatin1String(uri) != QLatin1String(package)) return; diff --git a/examples/sensors/grue/lib/gruesensor.h b/examples/sensors/grue/lib/gruesensor.h index b65e5d89..90379939 100644 --- a/examples/sensors/grue/lib/gruesensor.h +++ b/examples/sensors/grue/lib/gruesensor.h @@ -78,7 +78,7 @@ class Q_GRUE_EXPORT GrueFilter : public QSensorFilter public: virtual bool filter(GrueSensorReading *reading) = 0; private: - bool filter(QSensorReading *reading) { return filter(static_cast<GrueSensorReading*>(reading)); } + bool filter(QSensorReading *reading) override { return filter(static_cast<GrueSensorReading*>(reading)); } }; class Q_GRUE_EXPORT GrueSensor : public QSensor diff --git a/examples/sensors/grue/plugin/gruesensorimpl.h b/examples/sensors/grue/plugin/gruesensorimpl.h index 15c23b5f..0847ed9c 100644 --- a/examples/sensors/grue/plugin/gruesensorimpl.h +++ b/examples/sensors/grue/plugin/gruesensorimpl.h @@ -68,8 +68,8 @@ public: gruesensorimpl(QSensor *sensor); - void start(); - void stop(); + void start() override; + void stop() override; private Q_SLOTS: void lightChanged(); diff --git a/examples/sensors/grue/plugin/main.cpp b/examples/sensors/grue/plugin/main.cpp index c8fdc1d1..4c5da15d 100644 --- a/examples/sensors/grue/plugin/main.cpp +++ b/examples/sensors/grue/plugin/main.cpp @@ -61,12 +61,12 @@ class GrueSensorPlugin : public QObject, public QSensorPluginInterface, public Q Q_PLUGIN_METADATA(IID "com.qt-project.Qt.QSensorPluginInterface/1.0" FILE "plugin.json") Q_INTERFACES(QSensorPluginInterface QSensorChangesInterface) public: - void registerSensors() + void registerSensors() override { qDebug() << "loaded the grue plugin"; } - void sensorsChanged() + void sensorsChanged() override { if (!QSensor::defaultSensorForType(QAmbientLightSensor::type).isEmpty()) { // There is a light sensor available. Register the backend @@ -78,7 +78,7 @@ public: } } - QSensorBackend *createBackend(QSensor *sensor) + QSensorBackend *createBackend(QSensor *sensor) override { if (sensor->identifier() == gruesensorimpl::id) return new gruesensorimpl(sensor); diff --git a/examples/sensors/maze/Mouse.qml b/examples/sensors/maze/Mouse.qml index 7f8ea279..cf839910 100644 --- a/examples/sensors/maze/Mouse.qml +++ b/examples/sensors/maze/Mouse.qml @@ -62,6 +62,7 @@ Item { width: Lib.cellDimension height: Lib.cellDimension property int angle + readonly property double radians_to_degrees: 180 / Math.PI AnimatedImage { id: img @@ -79,8 +80,7 @@ Item { //! [0] var a = newy - mouse.y var b = newx - mouse.x - var radians_to_degrees = 57.2957795 - angle = Math.atan2(-b, a) * radians_to_degrees + angle = Math.atan2(-b, a) * mouse.radians_to_degrees if (angle < 0) angle = 360 + angle diff --git a/examples/sensors/qmlsensorgestures/plugin/qcountergestureplugin.h b/examples/sensors/qmlsensorgestures/plugin/qcountergestureplugin.h index e4198930..1b756328 100644 --- a/examples/sensors/qmlsensorgestures/plugin/qcountergestureplugin.h +++ b/examples/sensors/qmlsensorgestures/plugin/qcountergestureplugin.h @@ -66,11 +66,11 @@ public: explicit QCounterGesturePlugin(); ~QCounterGesturePlugin(); - QList <QSensorGestureRecognizer *> createRecognizers(); + QList<QSensorGestureRecognizer *> createRecognizers() override; QStringList gestureSignals() const; - QStringList supportedIds() const; - QString name() const { return "CounterGestures"; } + QStringList supportedIds() const override; + QString name() const override { return "CounterGestures"; } }; #endif // QCOUNTERGESTUREPLUGIN_H diff --git a/examples/sensors/qmlsensorgestures/plugin/qcounterrecognizer.h b/examples/sensors/qmlsensorgestures/plugin/qcounterrecognizer.h index abdf0332..4a0212ab 100644 --- a/examples/sensors/qmlsensorgestures/plugin/qcounterrecognizer.h +++ b/examples/sensors/qmlsensorgestures/plugin/qcounterrecognizer.h @@ -63,12 +63,12 @@ public: QCounterGestureRecognizer(QObject *parent = 0); ~QCounterGestureRecognizer(); - void create(); + void create() override; - QString id() const; - bool start(); - bool stop(); - bool isActive(); + QString id() const override; + bool start() override; + bool stop() override; + bool isActive() override; private slots: void timeout(); diff --git a/examples/sensors/sensor_explorer/import/main.cpp b/examples/sensors/sensor_explorer/import/main.cpp index 8acf56cc..b43ea339 100644 --- a/examples/sensors/sensor_explorer/import/main.cpp +++ b/examples/sensors/sensor_explorer/import/main.cpp @@ -60,7 +60,7 @@ class SensorExplorerDeclarativeModule : public QQmlExtensionPlugin Q_OBJECT Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid FILE "import.json") public: - virtual void registerTypes(const char *uri) + void registerTypes(const char *uri) override { Q_ASSERT(QLatin1String(uri) == QLatin1String("Explorer")); // @uri Explorer diff --git a/examples/sensors/sensorgestures/sensorgestures.pro b/examples/sensors/sensorgestures/sensorgestures.pro index a60728e7..e692a53c 100644 --- a/examples/sensors/sensorgestures/sensorgestures.pro +++ b/examples/sensors/sensorgestures/sensorgestures.pro @@ -1,6 +1,7 @@ TEMPLATE = app TARGET = gesture QT += sensors widgets +requires(qtConfig(treewidget)) SOURCES += main.cpp\ mainwindow.cpp |