Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Dynamically parent objects to a property list that is not the default
Forum Updated to NodeBB v4.3 + New Features

Dynamically parent objects to a property list that is not the default

Scheduled Pinned Locked Moved QML and Qt Quick
1 Posts 1 Posters 1.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • X Offline
    X Offline
    xsacha
    wrote on last edited by
    #1

    How can I do this? Is this possible?

    I ask because my current version of QtMobility (1.2.0-tp1) has a bug where the default property for Map is 'children' instead of 'objects'.
    It seems to have made it impossible to add objects to the list.
    Surely a property doesn't need to be default to be modified?

    It uses an object property to assign objects. You can initialize it like so:
    @objects: [MapCircle {}, MapRectangle {}]@
    or even with
    @objects: children[1]; /or/ objects: myID@

    But, even though the C++ type has an associated 'append' function, I can find no way to add elements to it. Does anyone know?

    Many properties have a similar problem -- for example VisualItemModel. However, you can work around this by creating children objects in the element itself or re-parent elements to it.
    This is because of how the 'default property list' is set. In the example of 'Map', default property list is 'children' rather than 'objects'. Map only displays objects (not children). Hence the issue I have come across.

    I can fix this by using:
    @Q_CLASSINFO("DefaultProperty", "objects")@
    in qdeclarativegraphicsgeomap_p.h (QtMobility source code)

    Is this a problem? Has anyone else encountered this?

    • Sacha
    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved