QMagnetometer Class

QMagnetometer 类是QSensor 的方便封装。更多

头文件: #include <QMagnetometer>
CMake: find_package(Qt6 REQUIRED COMPONENTS Sensors)
target_link_libraries(mytarget PRIVATE Qt6::Sensors)
qmake: QT += sensors
继承: QSensor

属性

公共功能

QMagnetometer(QObject *parent = nullptr)
virtual ~QMagnetometer()
QMagnetometerReading *reading() const
bool returnGeoValues() const
void setReturnGeoValues(bool returnGeoValues)

信号

void returnGeoValuesChanged(bool returnGeoValues)

详细说明

该类唯一的行为区别是正确设置了类型。

该类还有一个reading() 函数,返回QMagnetometerReading 而不是QSensorReading

有关传感器工作原理的详细信息,请参见QMagnetometerReading

另请参见 QMagnetometerReading

属性文档

returnGeoValues : bool

该属性的值表示是否返回地磁值。

设为 true 则返回地磁通密度。设为 false(默认值)则返回原始磁通密度。

必须在调用start() 之前设置该属性。

访问功能:

bool returnGeoValues() const
void setReturnGeoValues(bool returnGeoValues)

Notifier 信号:

void returnGeoValuesChanged(bool returnGeoValues)

成员函数 文档

[explicit] QMagnetometer::QMagnetometer(QObject *parent = nullptr)

将传感器构建为parent 的子节点。

[virtual noexcept] QMagnetometer::~QMagnetometer()

销毁传感器。如果传感器尚未停止,则将其停止。

QMagnetometerReading *QMagnetometer::reading() const

返回此传感器的读数类别。

另请参阅 QSensor::reading()。

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