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



  • 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?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.