QRotationSensor Class
QRotationSensor 类是QSensor 的方便封装。更多
头文件: | #include <QRotationSensor> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS Sensors) target_link_libraries(mytarget PRIVATE Qt6::Sensors) |
qmake: | QT += sensors |
继承: | QSensor |
属性
- hasZ : const bool
公共功能
QRotationSensor(QObject *parent = nullptr) | |
virtual | ~QRotationSensor() |
bool | hasZ() const |
QRotationReading * | reading() const |
void | setHasZ(bool hasZ) |
信号
void | hasZChanged(bool hasZ) |
详细说明
该类唯一的行为区别是正确设置了类型。
该类还有一个reading() 函数,返回QRotationReading 而不是QSensorReading 。
有关传感器工作原理的详细信息,请参见QRotationReading 。
另请参见 QRotationReading 。
属性文档
[read-only]
hasZ : const bool
该属性的值表示 z 角度是否可用。
如果 z 可用,则返回 true。如果 z 不可用,则返回 false。
访问功能:
bool | hasZ() const |
Notifier 信号:
void | hasZChanged(bool hasZ) |
成员函数 文档
[explicit]
QRotationSensor::QRotationSensor(QObject *parent = nullptr)
将传感器构建为parent 的子节点。
[virtual noexcept]
QRotationSensor::~QRotationSensor()
销毁传感器。如果传感器尚未停止,则将其停止。
QRotationReading *QRotationSensor::reading() const
返回此传感器的读数类别。
另请参阅 QSensor::reading()。
void QRotationSensor::setHasZ(bool hasZ)
设置hasZ 是否可以使用 Z 角度。该属性由后台调用。默认情况下,hasZ 属性为 true,因此后端只需在其旋转传感器无法报告 Z 角时调用此属性即可。
另请参阅 hasZ() 。
© 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.