diff options
author | Joona Petrell <joona.t.petrell@nokia.com> | 2010-07-28 08:45:23 (GMT) |
---|---|---|
committer | Joona Petrell <joona.t.petrell@nokia.com> | 2010-08-03 01:45:34 (GMT) |
commit | e62f266a7642e675e9d235a1f54a6b5746500d48 (patch) | |
tree | 7ed719f4539ecb0a634dad714105c70819683810 /demos/declarative/calculator | |
parent | 1fc6cab93ba2d067fadcd0979640c32aa1d5ae4a (diff) | |
download | Qt-e62f266a7642e675e9d235a1f54a6b5746500d48.zip Qt-e62f266a7642e675e9d235a1f54a6b5746500d48.tar.gz Qt-e62f266a7642e675e9d235a1f54a6b5746500d48.tar.bz2 |
Make it possible to manually set the orientation of QML Viewer on Symbian
Task-number: QTBUG-12142
Reviewed-by: Warwick Allison
This patch brings ability to switch QML Viewer's orientation between auto-orientation (=follow sensor),
portrait and landscape orientations (lock orientation) on Symbian. It provides same orientation options as
Qt Creator 2.1's Qt QML Standalone Application creation wizard. Also, menu item rotateOrientation now
works on Symbian, but it's hidden when orientation mode is set to auto-orientation.
Property runtime.orientation has been switched back to supporting four-way orientation on Symbian, previously
it only updated values between portrait and landscape. If your application only supports landscape or portrait
modes, just don't react to the inverted orientations.
Added orientation example screenorientation under examples/declarative.
The patch includes a fix for calculator example, which rotated to wrong direction when switching from portrait
to landscape. Also, improved qdeclarativeviewer unit tests. Changes have been tested to work on Windows,
Linux and Symbian^3.
Diffstat (limited to 'demos/declarative/calculator')
-rw-r--r-- | demos/declarative/calculator/Core/calculator.js | 4 | ||||
-rw-r--r-- | demos/declarative/calculator/calculator.qml | 14 |
2 files changed, 9 insertions, 9 deletions
diff --git a/demos/declarative/calculator/Core/calculator.js b/demos/declarative/calculator/Core/calculator.js index c80c42f..16cc309 100644 --- a/demos/declarative/calculator/Core/calculator.js +++ b/demos/declarative/calculator/Core/calculator.js @@ -83,9 +83,9 @@ function doOperation(op) { display.text ="0" } - if (op == rotateLeft) - main.state = "orientation " + Orientation.Landscape if (op == rotateRight) + main.state = "orientation " + Orientation.Landscape + if (op == rotateLeft) main.state = '' } diff --git a/demos/declarative/calculator/calculator.qml b/demos/declarative/calculator/calculator.qml index 63b6c55..288455b 100644 --- a/demos/declarative/calculator/calculator.qml +++ b/demos/declarative/calculator/calculator.qml @@ -85,7 +85,7 @@ Rectangle { Button { id: rotateButton - width: column.w; height: column.h; color: 'purple'; operation: rotateLeft + width: column.w; height: column.h; color: 'purple'; operation: rotateRight } Button { width: column.w; height: column.h; color: 'purple'; operation: leftArrow } Button { width: column.w; height: column.h; color: 'purple'; operation: "C" } @@ -134,18 +134,18 @@ Rectangle { states: [ State { name: "orientation " + Orientation.Landscape - PropertyChanges { target: main; rotation: -90; width: window.height; height: window.width } - PropertyChanges { target: rotateButton; operation: rotateRight } + PropertyChanges { target: main; rotation: 90; width: window.height; height: window.width } + PropertyChanges { target: rotateButton; operation: rotateLeft } }, State { name: "orientation " + Orientation.PortraitInverted - PropertyChanges { target: main; rotation: -180; } - PropertyChanges { target: rotateButton; operation: rotateLeft } + PropertyChanges { target: main; rotation: 180; } + PropertyChanges { target: rotateButton; operation: rotateRight } }, State { name: "orientation " + Orientation.LandscapeInverted - PropertyChanges { target: main; rotation: -270; width: window.height; height: window.width } - PropertyChanges { target: rotateButton; operation: rotateRight } + PropertyChanges { target: main; rotation: 270; width: window.height; height: window.width } + PropertyChanges { target: rotateButton; operation: rotateLeft } } ] |