-
Map and landmarks
I am trying to display on a Map elements retrieved from the network.
It seems possible to use landmarks to have the elements at the correct place on the map (see [url]http://doc.qt.nokia.com/qtmobility-1.2/declarative-location-landmarkmap-landmarkmap-qml.html[/url] ), but i cannot add landmarks that are not directly loaded from a file to the landmarkmodel.
I tried to use a ListModel populated by javascript, but i can't find how to declare a Coordinate element in javascript, and therefore the element is declared like this :
[code]
Component {
id: itemMapDelegate
Item {
property Coordinate coordinate: Coordinate {latitude: location.latitude; longitude: location.longitude}
Image {
id: landmarkIcon
y: map.toScreenPosition(coordinate).y
x: map.toScreenPosition(coordinate).x
}
}
}
[/code]
but if the map is moved, the position on the screen is not updated.
I don't really know where to go from here.
-
Re: Map and landmarks
just in case someone has the same issue, here is a simple way to overcome it :
in the map, just add
onCenterChanged: {
pinpointView.model = null
pinpointView.model = photos
}
this reloads the model and the iterator and works like a charm.
-
Re: Map and landmarks
actually there is a better way :
it is possible to create a Coordinate variable using createQmlObject:
var coord = Qt.createQmlObject('import QtMobility.location 1.1; Coordinate{latitude:' + lat + ';longitude:' + lon + ';}', container, "coord");
add it to the items in the listmodel, and voilà
-
Re: Map and landmarks
ok, i found the correct definition for this. the variant type is to be used for that kind of problems :
[code]
property variant coord: Coordinate {
latitude: lat
longitude: lng
}
[/code]