Unsolved 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.
C++
QMetaObject::invokeMethod(m_pMapObj, "addPlace", Q_ARG(QVariant, i->id));
Qml
Map { id: iMap ... function addPlace(placeIdx) { if (iMap.children) { for (var child in iMap.children) { var currentPlace = iMap.children[child]; if (currentPlace.idx === placeIdx) { iMap.addMapItem(currentPlace); break; } } } } }
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.
Qml
for (var chd in iMap.mapItems) { var cP = iMap.mapItems[chd]; console.log("name " + cP.sourceItem.objectname); }
Output
qml: name undefined
Does maybe anyone know what I'doing wrong here? Thxs...