本页内容

QHumidityReading Class

QHumidityReading 类存储了来自湿度传感器的读数。更多内容...

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

属性

公共函数

qreal absoluteHumidity() const
qreal relativeHumidity() const
void setAbsoluteHumidity(qreal value)
void setRelativeHumidity(qreal humidity)

详细说明

QHumidityReading 单位

湿度传感器返回的相对湿度以百分比表示,绝对湿度以克每立方米(g/m³)为单位。请注意,部分传感器可能不支持绝对湿度,在此情况下将返回 0。

属性文档

[read-only] absoluteHumidity : qreal

绝对湿度 以克每立方米为单位进行测量。请注意,某些传感器可能不支持绝对湿度。

访问功能:

qreal absoluteHumidity() const

另请参阅 QHumidityReading Units 。

[read-only] relativeHumidity : qreal

相对湿度 以百分比形式返回。

访问函数:

qreal relativeHumidity() const

另请参阅 QHumidityReading Units 。

成员函数文档

void QHumidityReading::setAbsoluteHumidity(qreal value)

将 `absoluteHumidity ` 设置为 `value`。

另请参阅 absoluteHumidity()。

void QHumidityReading::setRelativeHumidity(qreal humidity)

将 `relativeHumidity ` 设置为 `humidity`。

另请参阅 relativeHumidity()。

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