QOrientationReading Class

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

头: #include <QOrientationReading>
qmake: QT += sensors
Since: Qt 5.1
继承: QSensorReading

公共类型

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

特性

公共函数

QOrientationReading (QObject * parent = DECLARE_READING(QOrientationReading))
virtual ~QOrientationReading ()
QOrientationReading::Orientation orientation () const
void setOrientation (QOrientationReading::Orientation orientation )

重实现公共函数

virtual void copyValuesFrom (QSensorReading * other ) override

静态公共成员

const QMetaObject staticMetaObject

额外继承成员

详细描述

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 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.

常量 描述
QOrientationReading::Undefined 0 The orientation is unknown.
QOrientationReading::TopUp 1 The Top edge of the device is pointing up.
QOrientationReading::TopDown 2 The Top edge of the device is pointing down.
QOrientationReading::LeftUp 3 The Left edge of the device is pointing up.
QOrientationReading::RightUp 4 The Right edge of the device is pointing up.
QOrientationReading::FaceUp 5 The Face of the device is pointing up.
QOrientationReading::FaceDown 6 The 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.

访问函数:

QOrientationReading::Orientation orientation () const

另请参阅 QOrientationReading Units .

成员函数文档编制

QOrientationReading:: QOrientationReading ( QObject * parent = DECLARE_READING(QOrientationReading))

Default constructs an instance of QOrientationReading.

[virtual] QOrientationReading:: ~QOrientationReading ()

Destroys the instance of QOrientationReading. The destructor is virtual.

[override virtual] void QOrientationReading:: copyValuesFrom ( QSensorReading * other )

void QOrientationReading:: setOrientation ( QOrientationReading::Orientation orientation )

设置 orientation for the reading.

另请参阅 orientation ().