IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)

Changes to Qt Sensors

Migrate Qt Sensors to Qt 6.

Article lu   fois.

L'auteur

Liens sociaux

Viadeo Twitter Facebook Share on Google+   

Changes to Qt Sensors

Qt 6 is a result of the conscious effort to make the framework more efficient and easy to use.

We try to maintain binary and source compatibility for all the public APIs in each release. But some changes were inevitable in an effort to make Qt a better framework.

In this topic we summarize those changes in Qt Sensors, and provide guidance to handle them.

Sensor Gesture support

The Gesture support has been removed. In its current shape the gestures needs rethinking to be of more use for the developers. To track this please see QTBUG-95649.

Platform notes

 

Windows

On Windows, sensors are supported in Qt installations that were built with MSVC.

sensorfw

The sensorfw does not yet have a Qt 6 port and is therefore not yet supported by sensors in Qt 6.

TI Sensor Tag

Support for TI Sensor Tag has been removed.

Removed sensors

QAltimeter, QDistanceSensor, QHolsterSensor and their QML counterparts did no longer have a backend implementation and have been removed.

QIRProximitySensor, QLidSensor, and QTapSensor have only sensorfw backend, and as such they are not currently listed as supported sensor types.

Linux

The Linux sysfs accelerometer support has been removed. The backend is undocumented and has been without any real activity for almost 10 years.

API changes

 

Deleted typedef for qtimestamp

The typedef for the historical, QtMobility-era, qtimestamp has been removed. Use the actual type quint64 directly.

Renamed sensor type string to sensorType

The subclasses of QSensor implement a char const* string which defines the string that identifies the base sensor. This static type field shadowed the baseclass QSensor::type() method, leading to unnecessary compilation errors and consequent workarounds. The type string has been now renamed as sensorType.

Renamed LidReading::backLidChanged property to backLidClosed

The property name is now aligned with the frontLidClosed property of the same QML type.

Added parameter to QSensorBackend::sensorBusy() to be able to also clear

the busy state

The QSensor::busy property and its accessor, QSensor::isBusy(), can be used to check if the sensor is busy or not. To allow this property to better reflect the sensor backend's state, QSensorBackend::sensorBusy() now accepts a boolean parameter. This busy parameter is used to set/unset the backend busy state and notify the QSensor interface attached to it.

The default value for the QSensorBackend::sensorBusy() parameter is true which results in the original behavior (except the added signal emission). This means that in most if not all cases the changes are not mandatory. Instead it is up to the individual sensor backend implementations to decide if the changes are useful.

Sensor::type and and QSensor::type properties marked as constant

The type property cannot change after instantiation and is marked as constant in both C++ and QML.

Vous avez aimé ce tutoriel ? Alors partagez-le en cliquant sur les boutons suivants : Viadeo Twitter Facebook Share on Google+