QSensorManager#
The QSensorManager
class handles registration and creation of sensor backends. More…
Synopsis#
Static functions#
def
createBackend
(sensor)def
isBackendRegistered
(type, identifier)def
registerBackend
(type, identifier, factory)def
setDefaultBackend
(type, identifier)def
unregisterBackend
(type, identifier)
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#
Sensor plugins register backends using the registerBackend()
function.
When connectToBackend()
is called, the createBackend()
function will be called.
- class PySide6.QtSensors.QSensorManager#
- static PySide6.QtSensors.QSensorManager.createBackend(sensor)#
- Parameters:
sensor –
PySide6.QtSensors.QSensor
- Return type:
Create a backend for sensor
. Returns null if no suitable backend exists.
- static PySide6.QtSensors.QSensorManager.isBackendRegistered(type, identifier)#
- Parameters:
type –
PySide6.QtCore.QByteArray
identifier –
PySide6.QtCore.QByteArray
- Return type:
bool
Returns true if the backend identified by type
and identifier
is registered.
This is a convenience method that helps out plugins doing dynamic registration.
- static PySide6.QtSensors.QSensorManager.registerBackend(type, identifier, factory)#
- Parameters:
type –
PySide6.QtCore.QByteArray
identifier –
PySide6.QtCore.QByteArray
factory –
PySide6.QtSensors.QSensorBackendFactory
Register a sensor for type
. The identifier
must be unique.
The factory
will be asked to create instances of the backend.
Sensor identifiers starting with generic
or dummy
are given lower priority when choosing the default sensor if other sensors are found.
- static PySide6.QtSensors.QSensorManager.setDefaultBackend(type, identifier)#
- Parameters:
type –
PySide6.QtCore.QByteArray
identifier –
PySide6.QtCore.QByteArray
Sets or overwrite the sensor type
with the backend identifier
.
- static PySide6.QtSensors.QSensorManager.unregisterBackend(type, identifier)#
- Parameters:
type –
PySide6.QtCore.QByteArray
identifier –
PySide6.QtCore.QByteArray
Unregister the backend for type
with identifier
.
Note that this only prevents new instance of the backend from being created. It does not invalidate the existing instances of the backend. The backend code should handle the disappearance of the underlying hardware itself.