The QSensorFilter class provides an efficient callback facility for asynchronous notifications of sensor changes. More...
Header: | #include <QSensorFilter> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS Sensors) target_link_libraries(mytarget PRIVATE Qt6::Sensors) |
qmake: | QT += sensors |
Inherited By: |
QAccelerometerFilter, QAmbientLightFilter, QAmbientTemperatureFilter, QCompassFilter, QGyroscopeFilter, QHumidityFilter, QLightFilter, QMagnetometerFilter, QOrientationFilter, QPressureFilter, QProximityFilter, QRotationFilter, and QTiltFilter |
virtual bool | filter(QSensorReading *reading) = 0 |
virtual | ~QSensorFilter() |
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 QSensor::reading() will not be updated until after the filters have been run.
See also filter().
[virtual protected]
QSensorFilter::~QSensorFilter()Notifies the attached sensor (if any) that the filter is being destroyed.
[pure virtual]
bool QSensorFilter::filter(QSensorReading
*reading)This function is called when the sensor reading changes.
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.
As part of the free Business evaluation, we offer a free welcome call for companies, to talk about your requirements, and how the Felgo SDK & Services can help you. Just sign up and schedule your call.
Sign up now to start your free Business evaluation: