Skip to content
  • 0 Votes
    4 Posts
    695 Views
    lawrence.emkeL

    I am designing a game that has 100+ pieces. They are all have simple definitions and I am considering a dynamic creation of the pieces rather
    than static definitions. They will be associated with individual static locations
    on the playing surface. I thought reparenting of the visual parent will solve
    some problems. And since they will be dynamically created my understanding is that the instantiating object will still own the physical instances.

    Now I wonder, in my example, Was the reparented object's physical parent property also moved with the visual parent? Since the child elements are
    dynamically generated they don't have any id values. So where do I destroy
    them? Do I destroy (or modify) them under the generating object or the visual parent? and how do I obtain access to them?

    My first thought was the "children" property
    of the parent object. The children property seems to be a JS array. It does have a "length" attribute which keeps track of the number of children. But trying to
    access child object via " parent.children[ x] " does not seem to work.

    How do I access reparented objects without any id property? Do I do it from the physical parent or the visual parent? And what parent property do I use to access the object and its properties?

  • 0 Votes
    2 Posts
    975 Views
    sierdzioS

    Twój Rectangle jest root objektem w strukturze QMLa, więc nie ma rodzica - to normalne.

    Albo użyj QMLa do całego swojego GUI, albo dodaj objekty, których potrzebujesz do contextProperty w silniku QML.

  • 0 Votes
    4 Posts
    746 Views
    Stefan Monov76S

    @kshegunov :
    Sure, that works, but I was wondering why it doesn't work with parent as well.

    @Wieland :
    Ok, thanks!