本页内容

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

Element 报告以勒克斯(LUX)为单位的照度

Magnetometer

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

OrientationSensor

元件报告设备方向

PressureSensor

元件报告大气压值

ProximitySensor

Element 报告物体接近情况

RotationSensor

该组件报告设备围绕 X、Y 和 Z 轴的旋转情况

TiltSensor

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

QML 读取类型

来自传感器的数据通过读数类传递。

AccelerometerReading

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

AmbientLightReading

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

AmbientTemperatureReading

该元素保存了最新的温度读数

CompassReading

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

GyroscopeReading

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

HumidityReading

该元素存储了最新的湿度传感器读数

LightReading

该元素保存了最新的光传感器读数

MagnetometerReading

该元素存储了最新的磁力计读数

OrientationReading

该元素保存了最新的姿态传感器读数

PressureReading

该元素存储了压力传感器的最新读数

ProximityReading

该元素存储了最近一次接近传感器(ProximitySensor)的读数

RotationReading

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

TiltReading

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

所有 QML 类型

Accelerometer

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

AccelerometerReading

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

AmbientLightReading

该元素存储 AmbientLightSensor 的最新读数

AmbientLightSensor

该元素报告环境光照条件

AmbientTemperatureReading

该元素保存最新的温度读数

AmbientTemperatureSensor

该元素报告环境温度

Compass

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

CompassReading

该组件保存了最新的指南针读数

Gyroscope

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

GyroscopeReading

该组件保存了最新的陀螺仪读数

HumidityReading

该组件保存了湿度传感器的最新读数

HumiditySensor

该组件报告湿度数据

LightReading

该组件保存了最新的光传感器读数

LightSensor

该组件使用LUX单位报告光照强度

Magnetometer

该组件报告沿 Z、Y 和 Z 轴方向的磁场强度

MagnetometerReading

该组件保存了磁力计的最新读数

OrientationReading

该组件保存了OrientationSensor的最新读数

OrientationSensor

该元素报告设备方向

PressureReading

该元素保存了压力传感器的最新读数

PressureSensor

该元素报告大气压值

ProximityReading

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

ProximitySensor

该元素报告物体接近情况

QmlSensors

Singleton 提供模块 API

RotationReading

该元素保存了旋转传感器(RotationSensor)的最新读数

RotationSensor

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

Sensor

该元素作为传感器的基类

SensorReading

Element 作为传感器读数的基类型

TiltReading

Element 保存最新的 TiltSensor 读数

TiltSensor

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

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