Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
[Closed] Is it possible to create a dynamic QML instance of an element and give it an id ?
and if so, how ?
aalpert last edited by
No. If you dynamically create QML elements you have to manage them dynamically, via variables.
You can assign them to a property (such as children) of an element with an id, if you're having trouble finding them again after creation.
Thank you for your quick answer.
thisisbhaskar last edited by
Will this help you?
kunal_the_one last edited by
I used following code in one of my project.
Alicemirror last edited by
To work dynamically and manage the elements with id and properties, you can use them with the Loader elements. Loaders can be created and destroyed as you need at runtime.
frankiefrank last edited by
I was wondering the same thing. You can assign your own "id" to the objectName property:
Yes, but the fact is you have no protections of having two differents objects with the same objectName, which could be troubleSome.
After some work in QML, i find it not that much annoying, since the most important things are done in C++ side, except displaying, oeuf corse.
This is perhaps the time to close this post ;)