×
Namespaces

Variants
Actions
Revision as of 04:20, 11 October 2012 by hamishwillee (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Display portrait qml application in landscape

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Compatibility
Platform(s):
Symbian
Article
Created: paazmaya (03 Feb 2011)
Last edited: hamishwillee (11 Oct 2012)

Quite often an application is designed and build in a portrait mode and while the device used for testing it might be N900, the result is not what expected. The application is visible only half of the screen and literally in portrait.

To accommodate this, you can consider using the following snippet as a wrapper for the application and in this way still keep building it as portrait, but to be able to test it for example in N900.

QML

/**
* QML Application sizing and rotation as per N900
*/

import QtQuick 1.0 // Qt 4.7.1 and up, N900 with qt quick compatibility package
import Qt 4.7 // Qt 4.7.0
 
Rectangle {
id: runner
 
width: 800
height: 480
 
// Container element for rotating
Item {
height: 800
width: 480
transformOrigin: Item.TopLeft
y: width
rotation: -90
 
// Add the main QML element here...
MyApp {
 
}
}
}

QML with Qt

QmlApplicationViewer viewer;
// force lock for portrait mode
viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockPortrait);
This page was last modified on 11 October 2012, at 04:20.
73 page views in the last 30 days.
×