[Qt-qml] Screent Orientation and Active Window in Runtime Object
Rakesh.Mutharaju at tieto.com
Rakesh.Mutharaju at tieto.com
Mon May 3 08:42:38 CEST 2010
Hi,
I have a test application., test.qml
//test.qml
i took the Qt sources and compiled it myself. Based on Qt 4.7.0 (32 bit) built on Apr 8 2010 at 02:09:07
import Qt 4.7
Rectangle {
width: (Screen.orientation == Orientation.Landscape) ? 800 : 480
height: (Screen.orientation == Orientation.Landscape) ? 480 : 800
Text {
x: 66
y: 93
text: "Hello World"
}
}
On later versions of Qt
import Qt 4.7
Rectangle {
width: (runtime.orientation == Orientation.Landscape) ? 800 : 480
height: (runtime.orientation == Orientation.Landscape) ? 480 : 800
Text {
x: 66
y: 93
text: "Hello World"
}
}
Is this correct way of refering runtime object? Does it require any additional import statements??
In both cases I see the result as - error runtime[undefined] is not an object
Br,
Rakesh.M
-----Original Message-----
From: qt-qml-bounces at trolltech.com [mailto:qt-qml-bounces at trolltech.com] On Behalf Of Rakesh.Mutharaju at tieto.com
Sent: Monday, April 19, 2010 2:57 PM
To: leo.cunha at nokia.com; qt-qml at trolltech.com
Subject: Re: [Qt-qml] Screent Orientation and Active Window in Runtime Object
Hi,
If I have understand your message correctly, does this code snippet., changes to portait and landscape mode using when settings->properties change?
Import qt 4.7
Item {
state: (runtime.orientation == Orientation.Landscape)? 'landscape':''
Rectangle {
id: mainview
width: 480
height: 800
color: "#d2d2d2"
}
states: [
State {
name: "landscape"
PropertyChanges {
target: mainview
width: 800
height: 480
color: "#d2d2d2"
}
}
]
}
I am waiting for the intregation to be finished,so that i can try out the latest sources.
Cheers,
Rakesh
-----Original Message-----
From: qt-qml-bounces at trolltech.com [mailto:qt-qml-bounces at trolltech.com] On Behalf Of Leonardo Sobral Cunha
Sent: Wednesday, April 14, 2010 8:42 AM
To: qt-qml at trolltech.com
Subject: [Qt-qml] Screent Orientation and Active Window in Runtime Object
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
_______________________________________________
Qt-qml mailing list
Qt-qml at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml
_______________________________________________
Qt-qml mailing list
Qt-qml at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml
More information about the Qt-qml
mailing list