[Qt-qml] Screent Orientation and Active Window in Runtime Object

Leonardo Sobral Cunha leo.cunha at nokia.com
Wed Apr 14 07:41:41 CEST 2010


hi,

We just added a 'runtime' object in the root context. This 'runtime' has for 
now 2 properties: 'orientation' and 'isActiveWindow'

below are two examples on how to use the runtime properties, you just need to 
import Qt 4.7

import Qt 4.7
Item {
   state: (runtime.orientation == Orientation.Landscape) ? 'landscape' : ''
}

import Qt 4.7
   Item {
        width: 300; height: 200
        Rectangle {
            width: 100; height: 100
            color: "green"
            SequentialAnimation on x {
                running: runtime.isActiveWindow
                loops: Animation.Infinite
                NumberAnimation {to: 200}
                NumberAnimation {to: 0}
            }
        }
    }

NOTE that we removed the previous way of accessing the orientation through the 
Screen element .

the qmlruntime docs are also updated.
this change is still the qml repo waiting to be integrated.

br,
leo



More information about the Qt-qml mailing list