QSensorReading¶
The
QSensorReading
class holds the readings from the sensor. More…
Inherited by: QAccelerometerReading, QAltimeterReading, QAmbientLightReading, QAmbientTemperatureReading, QCompassReading, QDistanceReading, QGyroscopeReading, QHolsterReading, QHumidityReading, QIRProximityReading, QLidReading, QLightReading, QMagnetometerReading, QOrientationReading, QPressureReading, QProximityReading, QRotationReading, QTapReading, QTiltReading
Synopsis¶
Functions¶
def
setTimestamp
(timestamp)def
timestamp
()def
value
(index)def
valueCount
()
Virtual functions¶
def
copyValuesFrom
(other)
Detailed Description¶
Note that
QSensorReading
is not particularly useful by itself. The interesting data for each sensor is defined in a sub-class ofQSensorReading
.
- class PySide2.QtSensors.QSensorReading¶
- PySide2.QtSensors.QSensorReading.copyValuesFrom(other)¶
- Parameters:
other –
PySide2.QtSensors.QSensorReading
- PySide2.QtSensors.QSensorReading.setTimestamp(timestamp)¶
- Parameters:
timestamp – int
Sets the
timestamp
of the reading.See also
- PySide2.QtSensors.QSensorReading.timestamp()¶
- Return type:
int
This property holds the timestamp of the reading..
Timestamps values are microseconds since a fixed point. You can use timestamps to see how far apart two sensor readings are.
Note that sensor timestamps from different sensors may not be directly comparable (as they may choose different fixed points for their reference).
Note that some platforms do not deliver timestamps correctly . Applications should be prepared for occasional issues that cause timestamps to jump backwards.
- PySide2.QtSensors.QSensorReading.value(index)¶
- Parameters:
index – int
- Return type:
object
Returns the value of the property at
index
.Note that this function is slower than calling the data function directly.
Here is an example of getting a property via the different mechanisms available.
Accessing directly provides the best performance but requires compile-time knowledge of the data you are accessing.
QAccelerometerReading *reading = ...; qreal x = reading->x();
You can also access a property by name. To do this you must call
property()
.qreal x = reading->property("x").value<qreal>();
Finally, you can access values via numeric index.
qreal x = reading->value(0).value<qreal>();
Note that can only access properties declared with
Q_PROPERTY()
in sub-classes ofQSensorReading
.See also
valueCount()
property()
- PySide2.QtSensors.QSensorReading.valueCount()¶
- Return type:
int
Returns the number of extra properties that the reading has.
Note that this does not count properties declared in
QSensorReading
.As an example, this returns 3 for
QAccelerometerReading
because there are 3 properties defined in that class.
© 2022 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.