QSensorManager Class
La clase QSensorManager se encarga del registro y la creación de los backends de los sensores. Más información...
| Encabezado: | #include <QSensorManager> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS Sensors) target_link_libraries(mytarget PRIVATE Qt6::Sensors) |
| qmake: | QT += sensors |
Miembros públicos estáticos
| QSensorBackend * | createBackend(QSensor *sensor) |
| bool | isBackendRegistered(const QByteArray &type, const QByteArray &identifier) |
| void | registerBackend(const QByteArray &type, const QByteArray &identifier, QSensorBackendFactory *factory) |
| void | setDefaultBackend(const QByteArray &type, const QByteArray &identifier) |
| void | unregisterBackend(const QByteArray &type, const QByteArray &identifier) |
Descripción detallada
Los complementos de sensores registran los backends mediante la función registerBackend().
Cuando se llama a QSensor::connectToBackend(), se invocará la función createBackend().
Documentación de la función miembro
[static] QSensorBackend *QSensorManager::createBackend(QSensor *sensor)
Crea un backend para sensor. Devuelve «null» si no existe ningún backend adecuado.
[static] bool QSensorManager::isBackendRegistered(const QByteArray &type, const QByteArray &identifier)
Devuelve «true» si el backend identificado por type y identifier está registrado.
Se trata de un método de conveniencia que facilita a los complementos la realización de registros dinámicos.
[static] void QSensorManager::registerBackend(const QByteArray &type, const QByteArray &identifier, QSensorBackendFactory *factory)
Registra un sensor para type. El identifier debe ser único.
Se le pedirá al factory que cree instancias del backend.
Los identificadores de sensores que comienzan por generic o dummy tienen menor prioridad a la hora de elegir el sensor predeterminado si se encuentran otros sensores.
[static] void QSensorManager::setDefaultBackend(const QByteArray &type, const QByteArray &identifier)
Establece o sobrescribe la configuración del sensor type con el backend identifier.
[static] void QSensorManager::unregisterBackend(const QByteArray &type, const QByteArray &identifier)
Dale de baja el backend de type mediante identifier.
Ten en cuenta que esto solo impide que se creen nuevas instancias del backend. No invalida las instancias existentes del backend. El propio código del backend debe encargarse de gestionar la desaparición del hardware subyacente.
© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.