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.
Public Functions Index
Protected Functions Index
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.
Undefined The orientation is unknown. TopUp The Top edge of the device is pointing up. TopDown The Top edge of the device is pointing down. LeftUp The Left edge of the device is pointing up. RightUp The Right edge of the device is pointing up. FaceUp The Face of the device is pointing up. FaceDown 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.
- Undefined = 0
Sets the orientation for the reading.
Sets the timestamp of the reading.
Returns the value of the property at index.
Note that this function is slower than calling the data function directly.
Here is an example of getting a property via the different mechanisms available.
Accessing directly provides the best performance but requires compile-time knowledge of the data you are accessing.
QAccelerometerReading *reading = ...; qreal x = reading->x();
You can also access a property by name. To do this you must call QObject::property().
qreal x = reading->property("x").value<qreal>();
Finally, you can access values via numeric index.
qreal x = reading->value(0).value<qreal>();
(Only has inherited protected functions)
QScopedPointer< QSensorReadingPrivate > *
Licensees holding valid Qt Commercial licenses may use this document in accordance with the Qt Commercial License Agreement provided with the Software or, alternatively, in accordance with the terms contained in a written agreement between you and Nokia. Alternatively, this document may be used under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation.