Sensor QML Type

传感器元素是传感器的基本类型。更多

属性

方法

详细说明

传感器元素是传感器的基本类型。

该元素封装了QSensor 类。详情请查看QSensor 文档。

该元素不能直接创建。请使用其中一个子类。

属性文档

active : bool

该属性包含一个值,用于指示传感器是否处于活动状态。

有关此属性的信息,请参阅QSensor::active


alwaysOn : bool

该属性包含一个值,用于指示传感器是否应在屏幕关闭时保持运行。

有关此属性的信息,请参阅QSensor::alwaysOn


availableDataRates : list<Range>

该属性保存传感器支持的数据速率。

有关此属性的信息,请参阅QSensor::availableDataRates


axesOrientationMode : Sensor::AxesOrientationMode [since QtSensors 5.1]

该属性保存影响屏幕方向如何改变读数值的模式。

有关此属性的信息,请参阅QSensor::axesOrientationMode

此属性在 QtSensors 5.1 中引入。


bufferSize : int [since QtSensors 5.1]

该属性表示缓冲区的大小。

有关此属性的信息,请参阅QSensor::bufferSize

此属性在 QtSensors 5.1 中引入。


busy : bool

该属性保存一个值,用于指示传感器是否繁忙。

有关此属性的信息,请参阅QSensor::busy


connectedToBackend : bool

该属性包含一个值,用于指示传感器是否已连接到后端。

有关此属性的信息,请参阅QSensor::connectedToBackend


currentOrientation : int [since QtSensors 5.1]

该属性保存用于旋转读数值的当前方向。

有关此属性的信息,请参阅QSensor::currentOrientation

此属性在 QtSensors 5.1 中引入。


dataRate : int

该属性保存传感器运行时的数据速率。

有关此属性的信息,请参阅QSensor::dataRate


description : string

该属性保存传感器的描述性字符串。


efficientBufferSize : int [since QtSensors 5.1]

该属性保存最有效的缓冲区大小。

有关此属性的信息,请参阅QSensor::efficientBufferSize

该属性在 QtSensors 5.1 中引入。


error : int

该属性保存在传感器上设置的最后一个错误代码。


identifier : string

该属性保存传感器的后端标识符。

有关此属性的信息,请参阅QSensor::identifier


maxBufferSize : int [since QtSensors 5.1]

该属性保存最大缓冲区大小。

有关此属性的信息,请参阅QSensor::maxBufferSize

此属性在 QtSensors 5.1 中引入。


outputRange : int

该属性保存传感器使用的输出范围。

有关此属性的信息,请参阅QSensor::outputRange


outputRanges : list<OutputRange>

该属性保存传感器支持的输出范围列表。

有关此属性的信息,请参阅QSensor::outputRanges


reading : SensorReading

该属性保存读数类别。

有关此属性的信息,请参阅QSensor::reading

另请参阅 QML Reading types


skipDuplicates : bool [since QtSensors 5.1]

该属性表示是否应省略重复的读数值。

有关此属性的信息,请参阅QSensor::skipDuplicates

此属性在 QtSensors 5.1 中引入。


type : string

该属性表示传感器的类型。


userOrientation : int [since QtSensors 5.1]

该属性表示在 UserOrientation(用户方向)模式下用于旋转读数值的角度。

有关此属性的信息,请参阅QSensor::userOrientation

此属性在 QtSensors 5.1 中引入。


方法文档

[since QtSensors 6.7] bool isFeatureSupported(feature)

检查后端是否支持特定功能。如果feature 受支持,则返回true ,否则返回false 。有关功能说明,请参阅QSensor::Feature

有关信息,请参阅QSensor::isFeatureSupported

此方法在 QtSensors 6.7 中引入。


bool start()

开始从传感器获取值。如果传感器已启动,则返回 true,否则返回 false。

有关信息,请参阅QSensor::start() 。


bool stop()

停止从传感器获取值。如果传感器已停止,则返回 true,否则返回 false。

有关信息,请参阅QSensor::stop() 。


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