[Qt-qml] How to change initial state of Loader's sourceComponent?
mathias.malmqvist at nokia.com
mathias.malmqvist at nokia.com
Thu Jan 27 19:27:05 CET 2011
Hi,
Here's a little challenge for you all:
If we assume changing the definition of the "blueRect" Component below is not allowed,
is there any way to change the rest of the code such that the rectangle start out red instead
of blue without the ColorAnimation being triggered?
import QtQuick 1.0
Item {
width: 640
height: 480
Loader {
anchors.centerIn: parent
sourceComponent: blueRect
onLoaded: item.color = "red" // How make rect start out red without fade from blue?
}
MouseArea {
anchors.fill: parent
onClicked: loader.item.color = "green"
}
Component {
id: blueRect
Rectangle {
color: "blue"
Behavior on color { ColorAnimation { duration: 1000 } }
width: 100
height: 100
}
}
}
Cheers
Mathias
More information about the Qt-qml
mailing list