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

Girish Ramakrishnan girish at forwardbias.in
Tue Dec 28 02:20:36 CET 2010


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


More information about the Qt-qml mailing list