QCompassReading Class
QCompassReading 类表示罗盘的一个读数。更多
头文件: | #include <QCompassReading> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS Sensors) target_link_libraries(mytarget PRIVATE Qt6::Sensors) |
qmake: | QT += sensors |
继承: | QSensorReading |
属性
- azimuth : const qreal
- calibrationLevel : const 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 : const qreal
该属性用于保存设备的方位角。
根据QScreen::nativeOrientation 的定义,以设备顶部为基准,按顺时针方向从磁北测量,单位为度。
访问功能:
qreal | azimuth() const |
另请参阅 QCompassReading Units 。
[read-only]
calibrationLevel : const qreal
此属性表示读数的校准级别。
测量值从 0 到 1,数值越大越好。
访问功能:
qreal | calibrationLevel() const |
另请参阅 QCompassReading Units 。
成员函数文档
void QCompassReading::setAzimuth(qreal azimuth)
设置设备的azimuth 。
另请参阅 azimuth() 和QCompassReading Units 。
void QCompassReading::setCalibrationLevel(qreal calibrationLevel)
将读数的校准级别设置为calibrationLevel 。
另请参阅 calibrationLevel() 。
© 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.