PySide6.QtSensors.QOrientationReading¶
- class QOrientationReading¶
QOrientationReading
类表示来自方向传感器的一个读数。更多…概要¶
属性¶
orientationᅟ
- 设备的方向
方法¶
def
__init__()
def
orientation()
def
setOrientation()
注意
本文档可能包含从C++自动翻译到Python的代码片段。我们始终欢迎对代码片段翻译的贡献。如果您发现翻译问题,您也可以通过在我们的https:/bugreports.qt.io/projects/PYSIDE上创建工单来告知我们。
详细描述¶
方向传感器报告设备的方向。由于它在用户界面级别以下运行,它不会报告甚至不知道用户界面是如何旋转的。最重要的是,这意味着此传感器不能用于检测设备是否处于纵向或横向模式。
此传感器可用于检测设备的特定侧面是否朝上。
QOrientationReading 单位¶
方向传感器使用在
Orientation
枚举中预定义的值返回设备的方向。- class Orientation¶
此枚举表示设备的方向。
为了解释每个值的含义,参考下图会很有帮助。
方向按以下顺序显示:TopUp, TopDown, LeftUp, RightUp, FaceUp, FaceDown。
常量
描述
QOrientationReading.Undefined
方向未知。
QOrientationReading.TopUp
设备的顶部边缘朝上。
QOrientationReading.TopDown
设备的顶部边缘指向下方。
QOrientationReading.LeftUp
设备的左侧边缘朝上。
QOrientationReading.RightUp
设备的右侧边缘朝上。
QOrientationReading.FaceUp
设备的正面朝上。
QOrientationReading.FaceDown
设备的正面朝下。
需要注意的是,方向传感器报告的是设备的方向,而不是用户界面的方向。设备的方向不会仅仅因为用户界面的旋转而改变。这意味着这个传感器不能用于检测设备是处于纵向模式还是横向模式。
注意
当使用
from __feature__ import true_property
时,属性可以直接使用,否则通过访问器函数使用。- property orientationᅟ: QOrientationReading.Orientation¶
此属性保存设备的方向。
该单位是一个描述设备方向的枚举。
另请参阅
QOrientationReading 单位
- Access functions:
- orientation()¶
- Return type:
另请参阅
属性
orientationᅟ
的获取器。- setOrientation(orientation)¶
- Parameters:
方向 –
Orientation
设置阅读的
orientation
。另请参阅