[Qt-qml] Change property of dynamically created component
shiping.ji at nokia.com
shiping.ji at nokia.com
Wed Nov 10 10:39:29 CET 2010
Hi,
That solves the problem. One more related question, does it mean that dynamically created QML objects (incl. e.g. the one created using QDeclarativeComponent::create()) will not have their id registered?
We've noticed the issue that once we load and attach such objects programmatically, future binding update to these newly created objects will not work as it complains the object with the given id is not found. This has nothing to do with the loader though. Please confirm and we will send some sample code if you believe it should work and there is something wrong in our side.
Thanks again.
BR,
Shiping
-----Original Message-----
From: Allison Warwick (Nokia-MS-Qt/Brisbane)
Sent: 10 November, 2010 02:55
To: Ji Shiping (Nokia-MS/Espoo); Jones Martin (Nokia-MS-Qt/Brisbane); qt-qml at trolltech.com
Subject: RE: Change property of dynamically created component
The id of a component does not become a new global identifier. i.e. "yellowRect" below:
Component {
id: yellowRectComponent
Rectangle {
id: yellowRect
width: 100
height: 100
color: "yellow"
}
}
As you can imagine: if you had 2 loaders that loaded this, what would happen?
So, to fix your example, instead of:
PropertyChanges {
target: yellowRect
color: "gray"
}
You need:
PropertyChanges {
target: loader.item
color: "gray"
}
--
Warwick
More information about the Qt-qml
mailing list