Let's move on to a simple example that returns the device's position, accelerometer, gyroscope, ambient light, and magnetometer readings. Here's what our application looks like when running on a Huawei phone:
Note that my Huawei phone does not have a magnetometer, so these readings aren't being updated. Let's see how this works:
- First, we need to ensure that we include the positioning and sensor modules in our .pro file (if we don't, the application will compile but fail to launch):
QT += quick positioning sensors
- Next, we'll move on to the QML itself. This is long but straightforward. First, we add the necessary ...