View Single Post
marxian's Avatar
Posts: 2,448 | Thanked: 9,523 times | Joined on Aug 2010 @ Wigan, UK
#631
For the screen orientation, there is actually no need to bother with the JavaScript example. The way I handled screen orientation in cuteTube-QML (Fremantle version) is simply to check whether the height of the root element is greater than the width (which would be the case, if the device is in portrait orientation). Then you can use states to make any changes to positioning etc.

Example:

Code:
states: State {
        name: "portrait"
        when: window.height > window.width
        make property changes here
    }
In the example, the element referenced by the id window is the root element in my main.qml file. The properties of this element can be accessed from any of the other QML files.

As you say, Qt Components has other means of achieving this, but it works in a very similar way.
__________________
'Men of high position are allowed, by a special act of grace, to accomodate their reasoning to the answer they need. Logic is only required in those of lesser rank.' - J K Galbraith

My website

GitHub

Last edited by marxian; 2011-09-19 at 22:24.
 

The Following 5 Users Say Thank You to marxian For This Useful Post: