I'm making project using Qt Creator (Community) 5.5.1 with support of QML. I have this code:
main.qml:
MouseArea
{ anchors.fill: parent
onPressed: console.log('latitude = '+ (map.toCoordinate(Qt.point(mouse.x,mouse.y)).latitude),
'longitude = '+ (map.toCoordinate(Qt.point(mouse.x,mouse.y)).longitude));
So when I tap the screen, the coordinates of this place on the map are shown on console. But I don't know how I can use these coordinates to position the marker on the screen where the clicked occurred. Here is the marker code:
MapQuickItem {
id:marker
coordinate: QtPositioning.coordinate(******, ******);//stars are the coordinates
sourceItem: Image{
id: image
source: "marker2.png"
}
anchorPoint.x: image.width / 2
anchorPoint.y: image.height
}
What can I do to position the marker on map at the coordinates where the click occurred? Thanks.