Hi Anton,

On 09/07/2010, at 6:09 PM, ext Anton Alferov wrote:
> Is there any way to access element by it's id if that element was created 
> using js?

The set of ids in a component is effectively fixed at startup -- this allows us 
to do some important optimizations for binding resolution.

> For example, in the attached sample element rect1 created with js, and the 
> rect2 one tries to use it by id but unsuccessfully - the rect1 treats as 
> undefined object.

For an example like the above Loader should work very well; I'm not sure how 
close that matches your actual use case though. Have you tried using Loader?

Since createQmlObject returns the object it has created, you could possibly 
also look at saving the return value in an accessible property (though in the 
case of bindings that would likely generate a lot of warnings until the object 
was actually created)

Item {
    property variant rect1
    ...
    function create() {
        rect1 = Qt.createQmlObject(...)
    }
}

Regards,
Michael
_______________________________________________
Qt-qml mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt-qml

Reply via email to