QOrientationReading Class

The QOrientationReading class represents one reading from the orientation sensor. 更多...

头文件: #include <QOrientationReading>
qmake: QT += sensors
开始支持版本: Qt 5.1
基类: QSensorReading

公有类型

enum Orientation { Undefined, TopUp, TopDown, LeftUp, ..., FaceDown }

属性

公有函数

Orientation orientation() const
void setOrientation(Orientation orientation)

其他继承的成员

  • 1 个公有槽函数继承自 QObject
  • 2 个信号继承自 QObject
  • 1 个公有变量继承自 QObject
  • 10 个静态公有成员继承自 QObject
  • 9 个受保护的函数继承自 QObject
  • 2 个受保护的变量继承自 QObject

详细描述

The QOrientationReading class represents one reading from the orientation sensor.

The orientation sensor reports the orientation of the device. As it operates below the UI level it does not report on or even know how the UI is rotated. Most importantly this means that this sensor cannot be used to detect if a device is in portrait or landscape mode.

This sensor is useful to detect that a particular side of the device is pointing up.

QOrientationReading Units

The orientation sensor returns the orientation of the device using the pre-defined values found in the QOrientationReading::Orientation enum.

成员类型

enum QOrientationReading::Orientation

This enum represents the orientation of the device.

To explain the meaning of each value it is helpful to refer to the following diagram.

The orientations are shown here in order: TopUp, TopDown, LeftUp, RightUp, FaceUp, FaceDown.

ConstantValueDescription
QOrientationReading::Undefined0The orientation is unknown.
QOrientationReading::TopUp1The Top edge of the device is pointing up.
QOrientationReading::TopDown2The Top edge of the device is pointing down.
QOrientationReading::LeftUp3The Left edge of the device is pointing up.
QOrientationReading::RightUp4The Right edge of the device is pointing up.
QOrientationReading::FaceUp5The Face of the device is pointing up.
QOrientationReading::FaceDown6The Face of the device is pointing down.

It should be noted that the orientation sensor reports the orientation of the device and not the UI. The orientation of the device will not change just because the UI is rotated. This means this sensor cannot be used to detect if a device is in portrait or landscape mode.

属性

orientation : const Orientation

This property holds the orientation of the device.

The unit is an enumeration describing the orientation of the device.

访问函数:

Orientation orientation() const

参见 QOrientationReading Units.

成员函数

void QOrientationReading::setOrientation(Orientation orientation)

Sets the orientation for the reading.

参见 orientation().