QOrientationReading Class
QOrientationReading 类表示方向传感器的一个读数。更多
头文件: | #include <QOrientationReading> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS Sensors) target_link_libraries(mytarget PRIVATE Qt6::Sensors) |
qmake: | QT += sensors |
继承: | QSensorReading |
公共类型
enum | Orientation { Undefined, TopUp, TopDown, LeftUp, RightUp, …, FaceDown } |
属性
- orientation : const Orientation
公共功能
QOrientationReading::Orientation | orientation() const |
void | setOrientation(QOrientationReading::Orientation orientation) |
详细说明
方向传感器报告设备的方向。由于它在用户界面级别以下运行,因此不会报告或甚至不知道用户界面是如何旋转的。最重要的是,这意味着该传感器不能用于检测设备是处于纵向还是横向模式。
该传感器可用于检测设备的某一面是否朝上。
QOrientationReading 单元
方向传感器使用QOrientationReading::Orientation 枚举中的预定义值返回设备的方向。
成员类型文档
enum QOrientationReading::Orientation
该枚举表示设备的方向。
要解释每个值的含义,请参考下图。
这里显示的方向是按顺序排列的:TopUp(上)、TopDown(下)、LeftUp(左)、RightUp(右)、FaceUp(上)、FaceDown(下)。
常数 | 值 | 说明 |
---|---|---|
QOrientationReading::Undefined | 0 | 方向未知。 |
QOrientationReading::TopUp | 1 | 设备顶部边缘朝上。 |
QOrientationReading::TopDown | 2 | 设备顶部边缘朝下。 |
QOrientationReading::LeftUp | 3 | 设备左边缘朝上。 |
QOrientationReading::RightUp | 4 | 设备的右边缘朝上。 |
QOrientationReading::FaceUp | 5 | 设备面朝上。 |
QOrientationReading::FaceDown | 6 | 设备表面朝下。 |
请注意,方向传感器报告的是设备的方向,而不是用户界面的方向。设备的方向不会因为用户界面的旋转而改变。这意味着该传感器不能用于检测设备是纵向模式还是横向模式。
属性文档
[read-only]
orientation : const Orientation
该属性表示设备的方向。
单位是描述设备方向的枚举。
访问功能:
QOrientationReading::Orientation | orientation() const |
另请参阅 QOrientationReading Units 。
成员函数文档
void QOrientationReading::setOrientation(QOrientationReading::Orientation orientation)
为读数设置orientation 。
另请参阅 orientation().
© 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.