QCompassReading Class
QCompassReading 类表示罗盘的单次读数。更多内容...
| 头文件: | #include <QCompassReading> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS Sensors) target_link_libraries(mytarget PRIVATE Qt6::Sensors) |
| qmake: | QT += sensors |
| 继承自: | QSensorReading |
属性
- azimuth : qreal
- calibrationLevel : qreal
公共函数
| qreal | azimuth() const |
| qreal | calibrationLevel() const |
| void | setAzimuth(qreal azimuth) |
| void | setCalibrationLevel(qreal calibrationLevel) |
详细说明
QCompassReading 单位
该罗盘返回设备的方位角,以磁北为基准,以度为单位,顺时针方向计算,并以设备顶部为参照,具体定义见QScreen::nativeOrientation 。此外,还有一个值用于指示设备的校准状态。如果设备未经过校准,方位角可能不准确。
数字罗盘容易受到磁干扰,若将其放置在任何会产生磁力的物体附近,可能需要进行校准。附近的任何铁磁性材料都可能影响罗盘的精度。
设备的校准状态以0到1之间的数值表示。数值1代表设备支持的最高校准级别,0则代表最差。
属性文档
[read-only] azimuth : qreal
该属性存储设备的方位角。
该值以设备顶部为基准,以顺时针方向从磁北方向开始,单位为度,具体定义参见QScreen::nativeOrientation 。
访问函数:
| qreal | azimuth() const |
另请参阅 QCompassReading Units 。
[read-only] calibrationLevel : qreal
该属性存储读数的校准级别。
测量值为0到1之间的数值,数值越高越好。
访问函数:
| qreal | calibrationLevel() const |
另请参阅 QCompassReading Units 。
成员函数文档
void QCompassReading::setAzimuth(qreal azimuth)
设置设备的azimuth 。
另请参阅 azimuth() 和QCompassReading Units 。
void QCompassReading::setCalibrationLevel(qreal calibrationLevel)
将读数的校准级别设置为calibrationLevel 。
另请参阅 calibrationLevel()。
© 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.