Qt Sensors QML Types

QML 传感器模块 API

QmlSensors 是一个模块 API,提供有关当前可用传感器类型、标识符和默认传感器的信息。

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

模块 API 的文档可在QmlSensors 中找到。

QML 传感器类型

这些类型代表特定类型的传感器。

请注意,大多数属性来自抽象的Sensor 元素。

Accelerometer

沿 X、Y 和 Z 轴报告线性加速度的元素

AmbientLightSensor

元素报告环境照明条件

AmbientTemperatureSensor

元素报告环境温度

Compass

以磁北为基准报告航向的要素

Gyroscope

元素报告绕 X、Y 和 Z 轴的旋转加速度

HumiditySensor

元素报告湿度

LightSensor

元素使用 LUX 报告光照度

Magnetometer

元素报告沿 Z、Y 和 Z 轴的磁场强度

OrientationSensor

元素报告设备方向

PressureSensor

元素报告大气压力值

ProximitySensor

元素报告物体距离

RotationSensor

要素报告设备绕 X、Y 和 Z 轴的旋转情况

TiltSensor

元素报告沿 X 和 Y 轴的倾斜事件

QML 读取类型

传感器的数据来自读取类。

AccelerometerReading

元素保存最近的加速计读数

AmbientLightReading

元素保存环境光传感器的最新读数

AmbientTemperatureReading

元素保存最新的温度读数

CompassReading

元素保存最新的指南针读数

GyroscopeReading

元素保存陀螺仪的最新读数

HumidityReading

元素保存湿度传感器的最新读数

LightReading

元素保存最近的光传感器读数

MagnetometerReading

元素保存磁力计的最新读数

OrientationReading

元素保存方向传感器的最新读数

PressureReading

元素保存最近的压力传感器读数

ProximityReading

元素保存最近的接近传感器读数

RotationReading

元素保存旋转传感器的最新读数

TiltReading

元素保存最近的倾斜传感器读数

所有 QML 类型

Accelerometer

元素报告沿 X、Y 和 Z 轴的线性加速度

AccelerometerReading

元素保存最近的加速度计读数

AmbientLightReading

元素保存环境光传感器的最新读数

AmbientLightSensor

元素报告环境光照条件

AmbientTemperatureReading

元素保存最近的温度读数

AmbientTemperatureSensor

元素报告环境温度

Compass

元素报告以磁北为基准的航向

CompassReading

元素保存最新的指南针读数

Gyroscope

元素报告绕 X、Y 和 Z 轴的旋转加速度

GyroscopeReading

元素保存陀螺仪的最新读数

HumidityReading

元素保存湿度传感器的最新读数

HumiditySensor

元素报告湿度

LightReading

元素保存最近的光传感器读数

LightSensor

元素使用 LUX 报告光照度

Magnetometer

元素报告沿 Z、Y 和 Z 轴的磁场强度

MagnetometerReading

元素保存磁强计的最新读数

OrientationReading

元素保存方向传感器的最新读数

OrientationSensor

元素报告设备方向

PressureReading

元素保存最近的压力传感器读数

PressureSensor

元素报告大气压力值

ProximityReading

元素保存最近的接近传感器读数

ProximitySensor

元素报告物体距离

QmlSensors

单件提供模块 API

RotationReading

元素保存最近的旋转传感器读数

RotationSensor

元素报告设备绕 X、Y 和 Z 轴的旋转情况

Sensor

元素是传感器的基本类型

SensorReading

元素是传感器读数的基础类型

TiltReading

元素保存最近的倾斜传感器读数

TiltSensor

元素报告沿 X 和 Y 轴的倾斜事件

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