若模块被导入进名称空间,某些额外方法变为可用。
import QtSensors 5.15
// ...
Component.onCompleted: {
var types = QmlSensors.sensorTypes();
console.log(types.join(", "));
}
可以找到模块 API 文档编制在 QmlSensors .
这些类型表示特定传感器类型。
注意:大多数特性来自抽象 Sensor 元素。
数据来自传感器凭借读取类。
| Element reports on linear acceleration along the X, Y and Z axes | |
| Element holds the most recent Accelerometer reading | |
| 元素报告海拔 | |
| Element holds the most recent Altimeter reading | |
| Element holds the most AmbientLightSensor reading | |
| 元素报告环境照明条件 | |
| Element holds the most recent temperature reading | |
| 元素报告环境温度 | |
| Element reports on heading using magnetic north as a reference | |
| Element holds the most recent Compass reading | |
| Element holds the most recent DistanceSensor reading | |
| Element reports the distance in cm from an object to the device | |
| Element reports on rotational acceleration around the X, Y and Z axes | |
| Element holds the most recent Gyroscope reading | |
| Element holds the most recent HolsterSensor reading | |
| Element reports on whether a device is holstered | |
| Element holds the most recent HumiditySensor reading | |
| Element reports on humidity | |
| Element holds the most recent IR proximity reading | |
| Element reports on infra-red reflectance values | |
| Element holds the most recent LidSensor reading | |
| Element reports on whether a device is closed | |
| Element holds the most recent LightSensor reading | |
| Element reports on light levels using LUX | |
| Element reports on magnetic field strength along the Z, Y and Z axes | |
| Element holds the most recent Magnetometer reading | |
| Element holds the most recent OrientationSensor reading | |
| Element reports device orientation | |
| Element holds the most recent PressureSensor reading | |
| Element reports on atmospheric pressure values | |
| Element holds the most recent ProximitySensor reading | |
| Element reports on object proximity | |
| Singleton provides the module API | |
| Element holds the most recent RotationSensor reading | |
| Element reports on device rotation around the X, Y and Z axes | |
| Element serves as a base type for sensors | |
| Provides notifications when sensor-based gestures are detected | |
| Element serves as a base type for sensor readings | |
| Element holds the most recent TapSensor reading | |
| Element reports tap and double tap events along the X, Y and Z axes | |
| Element holds the most recent TiltSensor reading | |
| Element reports tilt events along the X and Y axes |