Important: Please read the Qt Code of Conduct -

Why can't read properties of list<MapItem> from a Qml map?

  • Unfortunately the current methode (create dynamically Qml objects in C++) and then add them to the map via addMapItem is slow. The reason is that I always must iterate through all childrens.


    QMetaObject::invokeMethod(m_pMapObj, "addPlace", Q_ARG(QVariant, i->id));


    Map {
       id: iMap
    function addPlace(placeIdx) {
      if (iMap.children) {
          for (var child in iMap.children) {
              var currentPlace = iMap.children[child];
             if (currentPlace.idx === placeIdx) {

    This works, but too slow. Now I found mapItems

    mapItems : list<MapItem>

    I can iterate through the MapQuickItem's but have no access to any property.


    for (var chd in iMap.mapItems) {
          var cP = iMap.mapItems[chd];
          console.log("name " + cP.sourceItem.objectname);


    qml: name undefined

    Does maybe anyone know what I'doing wrong here? Thxs...

Log in to reply