QSensorReading#

The QSensorReading class holds the readings from the sensor. More

Inheritance diagram of PySide6.QtSensors.QSensorReading

Inherited by: QTiltReading, QTapReading, QRotationReading, QProximityReading, QPressureReading, QOrientationReading, QMagnetometerReading, QLightReading, QLidReading, QIRProximityReading, QHumidityReading, QGyroscopeReading, QCompassReading, QAmbientTemperatureReading, QAmbientLightReading, QAccelerometerReading

Synopsis#

Properties#

Functions#

Virtual functions#

Note

This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE

Detailed Description#

Note that QSensorReading is not particularly useful by itself. The interesting data for each sensor is defined in a sub-class of QSensorReading .

class PySide6.QtSensors.QSensorReading#

Note

Properties can be used directly when from __feature__ import true_property is used or via accessor functions otherwise.

property PᅟySide6.QtSensors.QSensorReading.timestamp: 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.

Access functions:
PySide6.QtSensors.QSensorReading.copyValuesFrom(other)#
Parameters:

otherPySide6.QtSensors.QSensorReading

PySide6.QtSensors.QSensorReading.setTimestamp(timestamp)#
Parameters:

timestamp – int

Sets the timestamp of the reading.

See also

timestamp()

PySide6.QtSensors.QSensorReading.timestamp()#
Return type:

int

Returns the timestamp of the reading.

See also

setTimestamp()

Getter of property timestamp .

PySide6.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 QObject::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 value() can only access properties declared with Q_PROPERTY() in sub-classes of QSensorReading .

See also

valueCount() property()

PySide6.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.