summaryrefslogtreecommitdiffstats
path: root/examples/sensors/sensorsshowcase/doc
diff options
context:
space:
mode:
authorTamas Martinec <tamas.martinec@symbio.com>2021-10-26 16:13:51 +0300
committerTamas Martinec <tamas.martinec@symbio.com>2021-11-12 10:34:41 +0200
commit851ec98b341ed8ad67caac32653178e0bb189bfe (patch)
treee86ed84282f29ccea76b64e704ab2d549fa3fb0a /examples/sensors/sensorsshowcase/doc
parente49df5b12669b9ac754e2e1dd363e6797c7df0ba (diff)
QtSensors: Create a sensors showcase example
Create an example that demonstrates the sensor module sensors more visually than just displaying the sensor reading values. Pick-to: 6.2 Task-number: QTBUG-72329 Change-Id: I7383722124c3aae333cf9218613d7001c9d04690 Reviewed-by: Juha Vuolle <juha.vuolle@insta.fi>
Diffstat (limited to 'examples/sensors/sensorsshowcase/doc')
-rw-r--r--examples/sensors/sensorsshowcase/doc/images/sensorsshowcase-gyroscope.pngbin0 -> 29205 bytes
-rw-r--r--examples/sensors/sensorsshowcase/doc/images/sensorsshowcase-mainview.pngbin0 -> 33722 bytes
-rw-r--r--examples/sensors/sensorsshowcase/doc/src/sensorsshowcase.qdoc95
3 files changed, 95 insertions, 0 deletions
diff --git a/examples/sensors/sensorsshowcase/doc/images/sensorsshowcase-gyroscope.png b/examples/sensors/sensorsshowcase/doc/images/sensorsshowcase-gyroscope.png
new file mode 100644
index 00000000..b26aa459
--- /dev/null
+++ b/examples/sensors/sensorsshowcase/doc/images/sensorsshowcase-gyroscope.png
Binary files differ
diff --git a/examples/sensors/sensorsshowcase/doc/images/sensorsshowcase-mainview.png b/examples/sensors/sensorsshowcase/doc/images/sensorsshowcase-mainview.png
new file mode 100644
index 00000000..838b39c9
--- /dev/null
+++ b/examples/sensors/sensorsshowcase/doc/images/sensorsshowcase-mainview.png
Binary files differ
diff --git a/examples/sensors/sensorsshowcase/doc/src/sensorsshowcase.qdoc b/examples/sensors/sensorsshowcase/doc/src/sensorsshowcase.qdoc
new file mode 100644
index 00000000..b845d5d7
--- /dev/null
+++ b/examples/sensors/sensorsshowcase/doc/src/sensorsshowcase.qdoc
@@ -0,0 +1,95 @@
+/****************************************************************************
+**
+** Copyright (C) 2021 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \example sensorsshowcase
+ \title Qt Sensors - Sensors Showcase
+ \brief The Sensors Showcase example demonstrates sensor usage with visual examples.
+ \ingroup qtsensors-examples
+
+ \image sensorsshowcase-mainview.png
+
+ \section1 Overview
+
+ On startup, the application shows a menu with buttons for the subviews for each sensor.
+ The sensor views instantiate the given sensor, display the sensor's values as numbers,
+ and also visualize them with a simple graphical representation.
+
+ \section1 Main Menu
+
+ The main view shows the title with the name of the application and a button for each
+ subview laid out evenly by a \c ColumnLayout. The navigation between the subviews
+ and the main menu is managed by a \c StackView.
+
+ \section1 Accelerometer View
+
+ The accelerometer view shows the current device acceleration values and moves around
+ an image with an amount that is opposite of the device acceleration giving the image
+ an inertia effect that is proportional with the movement of the device.
+
+ Moving around the image happens in the accelerometer \c onReadingChanged method.
+
+ \snippet sensorsshowcase/accelerometer.qml 0
+
+ Whenever there is a new accelerometer value the image translation coordinates are
+ updated accordingly.
+
+ \section1 Proximity View
+
+ The proximity view shows an image that is enlarged whenever the proximity sensor of
+ the device is covered.
+
+ \section1 Compass View
+
+ The compass view shows a compass image that is rotated according to the Compass sensor
+ reading value making the compass turn towards north.
+
+ \section1 Magnetometer View
+
+ The magnetometer view displays a magnet image that is rotated around an amount that is
+ decided by the rotation angle of the vector given by the x and y magnetometer values.
+ This results in general in the same rotation as the compass gives, demonstrating one use
+ case of how the magnetometer readings can be used. Since the magnetometer provides
+ readings along all three axes, there is more freedom with how these readings can be used.
+
+ \snippet sensorsshowcase/magnetometer.qml 0
+
+ \section1 Gyroscope View
+
+ \image sensorsshowcase-gyroscope.png
+
+ The gyroscope view also shows an image that is rotated around three axes with an amount
+ that is calculated from the gyroscope readings. Since the gyroscope provides relative
+ rotational change around the three spatial axes and the time between reading updates
+ can vary, the time of the readings are stored and the rotational change is normalized
+ based on the time passed between reading updates.
+
+ \snippet sensorsshowcase/gyroscope.qml 0
+
+ By pressing the reset button the image rotation is reset to 0.
+*/
+