内容表

上一话题

QSensorPluginInterface

下一话题

QTapFilter

QSensorReading

QSensorReading class holds the readings from the sensor. 更多

Inheritance diagram of PySide2.QtSensors.QSensorReading

继承者: QAccelerometerReading , QAltimeterReading , QAmbientLightReading , QAmbientTemperatureReading , QCompassReading , QDistanceReading , QGyroscopeReading , QHolsterReading , QHumidityReading , QIRProximityReading , QLidReading , QLightReading , QMagnetometerReading , QOrientationReading , QPressureReading , QProximityReading , QRotationReading , QTapReading , QTiltReading

概要

函数

虚函数

详细描述

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

PySide2.QtSensors.QSensorReading. copyValuesFrom ( other )
参数

other QSensorReading

PySide2.QtSensors.QSensorReading. setTimestamp ( timestamp )
参数

timestamp quint64

设置 timestamp of the reading.

另请参阅

timestamp()

PySide2.QtSensors.QSensorReading. timestamp ( )
返回类型

quint64

Returns the timestamp of the reading.

另请参阅

setTimestamp()

PySide2.QtSensors.QSensorReading. value ( index )
参数

index int

返回类型

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 of QSensorReading .

另请参阅

valueCount() property()

PySide2.QtSensors.QSensorReading. valueCount ( )
返回类型

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.