Qt Sensors

The Qt Sensors API provides access to sensor hardware via QML and C++ interfaces.

Currently the API is supported on Android, iOS, and Windows (MSVC).

Information for Application Writers

Applications can access Qt Sensors using QML or C++.

To include the definitions of the module's classes, use the following directive:


 #include <QtSensors>

To import the QML types into your application, use the following import statement in your .qml file:


 import QtSensors

To link against the module:

Using cmake:


 find_package(Qt6 COMPONENTS Sensors REQUIRED)
 target_link_libraries(mytarget PRIVATE Qt6::Sensors)

Using qmake:


 QT += sensors

Further references:

QML TypesInformation about the Qt Sensors QML API
C++ ClassesInformation about the Qt Sensors C++ API
Qt Sensors C++ OverviewHigh-level information on how to use the C++ API.
ExamplesExamples demonstrating the use of the Qt Sensors APIs

Information for Backend Implementors

BackendInformation about the Qt Sensors back end
Qt Sensors - Grue Sensor ExampleThe Qt Sensors - Grue Sensor Example demonstrates creation of a sensor backend

Module Evolution

Changes to Qt Sensors lists important changes in the module API and functionality that were done for the Qt 6 series of Qt.

Platform-specific Information

Compatibility MapCompatibility map of all supported platforms.
Generic BackendInformation about the generic sensor backend.

The Qt Sensors module is available under commercial licenses from The Qt Company. In addition, it is available under free software licenses: The GNU Lesser General Public License, version 3, or the GNU General Public License, version 2. See Qt Licensing for further details.

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