Sensor QML Type
Sensor 元素是传感器的基类。更多内容...
| Import Statement: | import QtSensors |
| Since: | QtSensors 5.0 |
| Inherited By: |
属性
- active : bool
- alwaysOn : bool
- availableDataRates : list<Range>
- axesOrientationMode : Sensor::AxesOrientationMode
(since QtSensors 5.1) - bufferSize : int
(since QtSensors 5.1) - busy : bool
- connectedToBackend : bool
- currentOrientation : int
(since QtSensors 5.1) - dataRate : int
- description : string
- efficientBufferSize : int
(since QtSensors 5.1) - error : int
- identifier : string
- maxBufferSize : int
(since QtSensors 5.1) - outputRange : int
- outputRanges : list<OutputRange>
- reading : SensorReading
- skipDuplicates : bool
(since QtSensors 5.1) - type : string
- userOrientation : int
(since QtSensors 5.1)
方法
- bool isFeatureSupported(feature)
(since QtSensors 6.7) - bool start()
- bool stop()
详细说明
Sensor 元素是传感器的基类。
该元素封装了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()。
© 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.