本页内容

QmlSensors QML Type

QmlSensors 单例提供了该模块的 API。更多内容...

Import Statement: import QtSensors
Since: QtSensors 5.0

方法

详细说明

QmlSensors 单例提供了该模块的 API。

该元素无法直接创建,但可以像下文所示那样作为 QML 单例来访问其功能:

import QtSensors
import QtSensors as Sensors
...
    Component.onCompleted: {
        var types = Sensors.QmlSensors.sensorTypes();
        console.log(types.join(", "));
    }

方法文档

string defaultSensorForType(type)

返回已为type 注册的默认传感器标识符。

有关详细信息,请参阅QSensor::defaultSensorForType()。

list<string> sensorTypes()

返回已注册的传感器类型的列表。

有关详细信息,请参阅QSensor::sensorTypes()。

list<string> sensorsForType(type)

返回已为type 注册的传感器标识符列表。

有关详细信息,请参阅QSensor::sensorsForType()。

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