From 8724847a9e26e17852ee08b9b0d70b1d648661a0 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Mon, 5 Dec 2011 09:35:33 +1000 Subject: 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 --- examples/declarative/calculator/calculator.qml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'examples/declarative/calculator') 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 } } ] -- cgit v1.2.3