[SailfishDevel] Generating MapQuickItems from model
Antoine Reversat
a.reversat at gmail.com
Thu Nov 28 08:52:24 UTC 2013
Hi guys (and gals),
I'm trying to populate a map with marker based on a model.
I wanted to do this
Map {
id: stationsMap
anchors.fill: parent
plugin: nokia
center: currentLocation.coordinate
zoomLevel: stationsMap.maximumZoomLevel - 7
gesture.enabled: true
Repeater {
model: myModel
delegate: Marker {
coordinate: QtPositioning.coordinate(latitude, longitude)
}
}
}
Each entry in my model contains a latitude and longitude property
Here is Marker.qml
import QtQuick 2.0
import QtLocation 5.0
MapQuickItem {
property string type: "station"
sourceItem: Image {
id: marker
source: type == "station" ? "../images/bikster-marker.png" :
"../images/you-marker.png"
}
anchorPoint.x: marker.width/2
anchorPoint.y: marker.height
}
Can somebody tell me what I'm doing wrong or the right way to dynamically
add markers to my map ?
Antoine
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.sailfishos.org/pipermail/devel/attachments/20131128/aa6fb64b/attachment.html>
More information about the Devel
mailing list