Nominate our 2022 Qt Champions!

How do I create multiple Dynamic Objects that have some kind of indexed id?



  • So what I want to do is create enemy space ships in an index based way so that I can destroy one of them and when I try to access properties I am not dealing with things that no longer exist.


  • Moderators

    Simply use a QList<QObject*> or QVariantList, depending on your space ship backend implementation.

    If you want a QML-only solution, for some reason - you can parent all your space ships under a single Item and then access them using item.children.


Log in to reply