diff options
author | Alan Alpert <alan.alpert@nokia.com> | 2011-12-05 09:35:33 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-12-09 08:58:10 +0100 |
commit | 8724847a9e26e17852ee08b9b0d70b1d648661a0 (patch) | |
tree | 4540f67e6a051a0221c8ba884cdf963651918550 /examples/declarative/calculator | |
parent | f64d29ea65d002d1af3f24cc05f9859f629fa4fe (diff) |
Add Screen attached object
Use this to get details of the screen such as size and current
orientation.
As well as adding its own example, this commit updates Calculator to
use Screen instead of Runtime for orientation.
Change-Id: I1b73d2ee22a92b1dee827de1bd893eebec9f5817
Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
Diffstat (limited to 'examples/declarative/calculator')
-rw-r--r-- | examples/declarative/calculator/calculator.qml | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/examples/declarative/calculator/calculator.qml b/examples/declarative/calculator/calculator.qml index 06f08eeb86..3d8d8f702b 100644 --- a/examples/declarative/calculator/calculator.qml +++ b/examples/declarative/calculator/calculator.qml @@ -40,6 +40,7 @@ ****************************************************************************/ import QtQuick 2.0 +import QtQuick.Window 2.0 import "Core" import "Core/calculator.js" as CalcEngine @@ -61,7 +62,7 @@ Rectangle { Item { id: main - state: "orientation " + runtime.orientation + state: "orientation " + Screen.currentOrientation property bool landscapeWindow: window.width > window.height property real baseWidth: landscapeWindow ? window.height : window.width @@ -139,15 +140,15 @@ Rectangle { states: [ State { - name: "orientation " + Orientation.Landscape + name: "orientation " + Qt.LandscapeOrientation PropertyChanges { target: main; rotation: 90 + rotationDelta; width: main.baseHeight; height: main.baseWidth } }, State { - name: "orientation " + Orientation.PortraitInverted + name: "orientation " + Qt.InvertedPortraitOrientation PropertyChanges { target: main; rotation: 180 + rotationDelta; } }, State { - name: "orientation " + Orientation.LandscapeInverted + name: "orientation " + Qt.InvertedLandscapeOrientation PropertyChanges { target: main; rotation: 270 + rotationDelta; width: main.baseHeight; height: main.baseWidth } } ] |