内容表

上一话题

QSensorChangesInterface

下一话题

QSensorGestureManager

QSensorFilter

QSensorFilter class provides an efficient callback facility for asynchronous notifications of sensor changes. 更多

Inheritance diagram of PySide2.QtSensors.QSensorFilter

继承者: QAccelerometerFilter , QAltimeterFilter , QAmbientLightFilter , QAmbientTemperatureFilter , QCompassFilter , QDistanceFilter , QGyroscopeFilter , QHolsterFilter , QHumidityFilter , QIRProximityFilter , QLidFilter , QLightFilter , QMagnetometerFilter , QOrientationFilter , QPressureFilter , QProximityFilter , QRotationFilter , QTapFilter , QTiltFilter

详细描述

Some sensors (eg. the accelerometer) are often accessed very frequently. This may be slowed down by the use of signals and slots. The QSensorFilter interface provides a more efficient way for the sensor to notify your class that the sensor has changed.

Additionally, multiple filters can be added to a sensor. They are called in order and each filter has the option to modify the values in the reading or to suppress the reading altogether.

Note that the values in the class returned by reading() will not be updated until after the filters have been run.

另请参阅

filter()

class QSensorFilter
PySide2.QtSensors.QSensorFilter. m_sensor
PySide2.QtSensors.QSensorFilter. filter ( reading )
参数

reading QSensorReading

返回类型

bool

This function is called when the sensor reading 改变。

The filter can modify the reading.

Returns true to allow the next filter to receive the value. If this is the last filter, returning true causes the signal to be emitted and the value is stored in the sensor.

Returns false to drop the reading.

PySide2.QtSensors.QSensorFilter. setSensor ( sensor )
参数

sensor QSensor