[Qt-qml] How to assign an object id?

Brandon Sun knightsyj at gmail.com
Wed Dec 29 03:10:00 CET 2010


Quoted from Qt Doc<http://doc.trolltech.com/4.7-snapshot/qdeclarativedynamicobjects.html>

Also, note that while dynamically created objects may be used the same as
> other objects, they do not have an id in QML.


Although I also think there're requirements that we need manipulate
dynamically created objects by ID, but unfortunately, there's only this
simple sentence in the doc to explain the ID issue.

Maybe nokia guys could tell more on this.

Thanks,
Brandon

On Tue, Dec 28, 2010 at 9:20 AM, Girish Ramakrishnan
<girish at forwardbias.in>wrote:

> Hi Mathias,
>
> On Tue, Dec 28, 2010 at 6:15 AM,  <mathias.malmqvist at nokia.com> wrote:
> > Quick question; anyone know if it's possible to give an element created
> by
> > calling createObject() on a component an id?
> >
> > The documentation only says how to give it a parent:
> >
> http://doc.qt.nokia.com/4.7-snapshot/qml-component.html#createObject-method
> > and ids can simply be assigned like other properties.
> >
>
> Id's aren't anything like properties, so I think you mean ids *cannot*
> be simply assigned like other properties. I would like to be proven
> otherwise, but I don't think it's possible to give an element an id. I
> would think that after object creation, bindings have already been
> setup based on the ids in the scope chain and it's too late to give an
> id after all that. Maybe it makes sense to give an id to
> createComponent().
>
> Girish
> _______________________________________________
> Qt-qml mailing list
> Qt-qml at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-qml
>



-- 
Regards,
Brandon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt.nokia.com/pipermail/qt-qml/attachments/20101229/0c9648dc/attachment.html 


More information about the Qt-qml mailing list