[Interest] QML id as string?

Jérôme Godbout godboutj at amotus.ca
Wed Oct 3 18:10:41 CEST 2018


Take care, id are special property and they can be multiple based on the
context

// A.qml
Item
{
   id: component
}

// B.qml
Item
{
   A
   {
       id: toto
   }
}

What would be the id to be used for the A object with both id component and
toto? This is why you probably want to give it a UUID for the objectname or
print the whole hierarchy of parent to discover which one it is. The
objectname also make it easy to find an object with the property. But
setting a property with the id literal is a bad idea.

On Wed, 3 Oct 2018 at 11:52, Jason H <jhihn at gmx.com> wrote:

> I keep running into the fact that I want to be able to use QML item ids as
> strings. However no such child exists. I realize we can use the objectName
> property, but them I'm maintaining an objectName, which is no worse or
> better than me maintaining it myself. It would be a big help f I could set
> up a binding:
> objectName: id
> or
> objectName: ""+id
>
> Instead I have to maintain a name to object mapping as a property, which
> shouldn't be needed.
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>


-- 



RAPPROCHEZ LA DISTANCE


*Jérôme Godbout*Senior Software Developer

*p:* +1 (418) 800-1073 ext.:109

*m:* +1 (581) 777-0050

amotus.ca <http://www.amotus-solutions.com/>
statum-iot.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20181003/94fbfb69/attachment.html>


More information about the Interest mailing list