Description
The "QtSensors" Quick library provides access to the sensors data with:
// sensorsquick/qmlsensor_p.h
Q_PROPERTY(QmlSensorReading* reading READ reading NOTIFY readingChanged BINDABLE bindableReading)
Whereas the actual Sensors provides: Qml<Sensor>Reading during runtime by overriding the createReading function. For example:
// sensorsquick/qmlmagnetometer_p.h QmlSensorReading *createReading() const override; ... QmlSensorReading *QmlMagnetometer::createReading() const { return new QmlMagnetometerReading(m_sensor); }
If you would run qmllint on a minimal example like so:
import QtSensors Magnetometer { property real mx property real my onReadingChanged: { mx = reading.x my = ((reading as MagnetometerReading).y) } } // Produces: // Warning ~: Member "x" not found on type "QmlSensorReading" [missing property] // mx = reading.x
Using some magic to read into my resolves the warning. It is quite inconvenient, and its syntax is not easily understandable.
Discussed in: https://codereview.qt-project.org/c/qt/qtsensors/+/472100