QLightSensor Class
QLightSensor 类是围绕 `QSensor` 构建的一个便捷封装类。更多内容...
| 头文件: | #include <QLightSensor> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS Sensors) target_link_libraries(mytarget PRIVATE Qt6::Sensors) |
| qmake: | QT += sensors |
| 继承自: | QSensor |
属性
- fieldOfView : qreal
公共函数
| QLightSensor(QObject *parent = nullptr) | |
| virtual | ~QLightSensor() |
| qreal | fieldOfView() const |
| QLightReading * | reading() const |
| void | setFieldOfView(qreal fieldOfView) |
信号
| void | fieldOfViewChanged(qreal fieldOfView) |
详细说明
唯一的行为差异在于,该类会正确设置类型。
该类还提供了一个reading()函数,该函数返回QLightReading ,而不是QSensorReading 。
有关传感器工作原理的详细信息,请参阅QLightReading 。
另请参阅 QLightReading 。
属性文档
[read-only] fieldOfView : qreal
该属性存储一个表示视场的值。
这是一个表示传感器视场的角度。
并非所有光传感器都支持获取其视场角。对于不支持此属性的传感器,该值将为 0。可通过QSensor::isFeatureSupported() 方法和QSensor::FieldOfView 标志来检查是否支持视场角。
访问函数:
| qreal | fieldOfView() const |
通知信号:
| void | fieldOfViewChanged(qreal fieldOfView) |
成员函数文档
[explicit] QLightSensor::QLightSensor(QObject *parent = nullptr)
将该传感器作为parent 的子节点进行构建。
[virtual noexcept] QLightSensor::~QLightSensor()
销毁该传感器。如果该传感器尚未停止运行,则将其停止。
QLightReading *QLightSensor::reading() const
返回该传感器的读取类。
另请参阅 QSensor::reading()。
void QLightSensor::setFieldOfView(qreal fieldOfView)
将视场设置为fieldOfView 。此操作应由后端调用。
另请参阅 fieldOfView()。
© 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.