Thanks for the suggestion, now it's easier not to forget about it :-) As for the patch i mentioned, that was related to the map center issue you reported. Patch being: https://codereview.qt-project.org/168204 (now merged in 5.7)
best, Paolo On Tue, 6 Sep 2016 22:53:31 +0530 Kishore J <kitts.mailingli...@gmail.com> wrote: > Done. https://bugreports.qt.io/browse/QTBUG-55782 > > Given the limitation, I think my immediate alternative is to create a > MapItemView like component that is instantiated outside and write > code in the map that calls addMapItem and removeMapItem on the map as > and when the list is modified. To the drawing board... > > Is the patch for the bug requiring to call addMapItem for each item > in the MapItemView delegate is due for the next release? i.e. 5.8? > > How about the bug relating to the setting the center of the map? Its > easy to work around but I want to know if it's me doing something > wrong. -- > Regards, > Kishore > > On Tue, Sep 6, 2016 at 9:25 PM, Paolo Angelelli > <paolo.angele...@qt.io> wrote: > > > On Tue, 6 Sep 2016 19:04:34 +0530 > > Kishore J <kitts.mailingli...@gmail.com> wrote: > > > > > Hi > > > > > > I am inching forward with using QML maps in my C++ application. > > > Now i'm interested in dynamically adding multiple MapItemView > > > objects to a given map. > > > > > > > > > import QtQuick 2.5 > > > import QtLocation 5.6 > > > > > > Map { > > > id: map > > > objectName: "MyMap" > > > // zoomLevel: (maximumZoomLevel - minimumZoomLevel)/2 > > > zoomLevel: minimumZoomLevel > > > > > > plugin: Plugin { > > > name: "here" > > > PluginParameter {name: "here.app_id"; value: "xxxxx"} > > > PluginParameter {name: "here.token"; value: "xxxxx"} > > > } > > > // activeMapType: supportedMapTypes[3] > > > center { > > > latitude: 10 > > > longitude: 20 > > > } > > > > > > MapCircle { > > > id: staticCircle > > > center { > > > latitude: 5 > > > longitude: 10 > > > } > > > radius: 500000.0 > > > color: 'yellow' > > > border.width: 4 > > > border.color: 'yellow' > > > Component.onCompleted: { > > > console.debug("Loaded static MapCircle") > > > console.debug(center + ' radius: ' + radius) > > > } > > > Component.onDestruction: { > > > console.debug("Unloaded static MapCircle") > > > } > > > } > > > > > > MapItemView { > > > id: mapitemview > > > objectName: "MyMapItemView" > > > model: ListModel { > > > id: list > > > ListElement{lat: 10; lon: 20; rad: 800000} > > > ListElement{lat: 30; lon: 40; rad: 700000} > > > } > > > delegate: Component { > > > id: delegate > > > > > > MapCircle { > > > id: dynmapcircle > > > center { > > > latitude: lat; > > > longitude: lon; > > > } > > > radius: 500000.0 > > > color: 'black' > > > border.width: 4 > > > border.color: 'black' > > > Component.onCompleted: { > > > console.count("Loaded a MapCircle") > > > map.addMapItem(dynmapcircle) > > > } > > > } > > > } > > > > > > Component.onCompleted: { > > > console.debug("Loaded first MapItemView") > > > console.debug(model.count) > > > } > > > Component.onDestruction: { > > > console.debug("Unloaded first MapItemView") > > > } > > > } > > > > > > MapItemView { > > > id: mapitemview2 > > > objectName: "MyMapItemView2" > > > model: ListModel { > > > id: list2 > > > ListElement{lat: -10; lon: 20; rad: 800000} > > > ListElement{lat: -30; lon: 40; rad: 700000} > > > } > > > delegate: Component { > > > id: delegate2 > > > > > > MapCircle { > > > id: dynmapcircle2 > > > center { > > > latitude: lat; > > > longitude: lon; > > > } > > > radius: 500000.0 > > > color: 'blue' > > > border.width: 4 > > > border.color: 'blue' > > > Component.onCompleted: { > > > console.count("Loaded a MapCircle2") > > > map.addMapItem(dynmapcircle2) > > > } > > > } > > > } > > > > > > Component.onCompleted: { > > > console.debug("Loaded second MapItemView") > > > } > > > Component.onDestruction: { > > > console.debug("Unloaded second MapItemView") > > > } > > > } > > > > > > Component.onCompleted:{ > > > center.latitude = 10 > > > center.longitude = 20 > > > console.debug('Loaded map ' + map.center) > > > } > > > Component.onDestruction:{ > > > console.debug('Unloaded map') > > > } > > > } > > > > > > Further, i do not understand why i have to call the > > > map.addMapItem() function for each MapItem. I suspect that, that > > > is the source of my problem. I am currently able to define a > > > separate qml file containing the second MapItemView which i > > > instantiate in C++ and set the map as it's parent but that does > > > not work. > > > > > > Any help would be appreciated. > > > -- > > > Regards, > > > Kishore > > > > > > PS: I also seem to be facing another issue where the center value > > > specified in the map initialization does not work and I have to > > > set the center in the onCompleted() slot. Funnily, it only > > > considers the Latitude or Longitude value in the initialization > > > depending on which is first specified! > > > > Hi, for the first question, the answer is "you can't". > > This is a limitation of the current API, and something that might be > > worthwile extending. > > So feel free to send a feature request to jira. > > > > For the second question, please have a look if the (now merged) > > patch fixes your bug > > > > best, > > Paolo > > _______________________________________________ > > Interest mailing list > > Interest@qt-project.org > > http://lists.qt-project.org/mailman/listinfo/interest > > _______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest