이 페이지에서

QSensorManager Class

QSensorManager 클래스는 센서 백엔드의 등록 및 생성을 처리합니다. 더 보기...

헤더: #include <QSensorManager>
CMake: find_package(Qt6 REQUIRED COMPONENTS Sensors)
target_link_libraries(mytarget PRIVATE Qt6::Sensors)
qmake: QT += sensors

정적 공용 멤버

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)

상세 설명

센서 플러그인은 registerBackend() 함수를 사용하여 백엔드를 등록합니다.

QSensor::connectToBackend()이 호출되면 createBackend() 함수가 호출됩니다.

멤버 함수 문서

[static] QSensorBackend *QSensorManager::createBackend(QSensor *sensor)

sensor 에 대한 백엔드를 생성합니다. 적합한 백엔드가 없는 경우 null을 반환합니다.

[static] bool QSensorManager::isBackendRegistered(const QByteArray &type, const QByteArray &identifier)

type 및 identifier 로 식별되는 백엔드가 등록되어 있으면 true를 반환합니다.

이 메서드는 플러그인이 동적 등록을 수행하는 데 도움을 주는 편의 메서드입니다.

[static] void QSensorManager::registerBackend(const QByteArray &type, const QByteArray &identifier, QSensorBackendFactory *factory)

type 에 센서를 등록합니다. identifier 는 고유해야 합니다.

factory 는 백엔드 인스턴스를 생성하라는 요청을 받게 됩니다.

다른 센서가 발견된 경우, 기본 센서를 선택할 때 generic 또는 dummy 로 시작하는 센서 식별자는 우선순위가 낮아집니다.

[static] void QSensorManager::setDefaultBackend(const QByteArray &type, const QByteArray &identifier)

센서 type 를 백엔드 identifier 로 설정하거나 덮어씁니다.

[static] void QSensorManager::unregisterBackend(const QByteArray &type, const QByteArray &identifier)

identifier 를 사용하여 type 의 백엔드 등록을 해제합니다.

이 작업은 백엔드의 새로운 인스턴스가 생성되는 것만 방지할 뿐, 기존 백엔드 인스턴스를 무효화하지는 않는다는 점에 유의하십시오. 백엔드 코드 자체에서 기반이 되는 하드웨어의 소실을 처리해야 합니다.

© 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.