qtqt-quickqtlocation

Qt Quick MapPolyLine insertCoordinate


I have a PolyLine on my map and want to add a new co-ordinate to it when a user clicks between two existing points.

I can get the click event with:-

 MouseArea {
    id: mouseArea
    anchors.fill: parent
    acceptedButtons: Qt.LeftButton | Qt.RightButton
    onClicked: {
        console.log('LINE');
    }
}

But I cannot figure out how to work out the required index for insertCoordinate() as there does not appear to be a method to get the start/end vertices of the segment clicked. Is this possible?


Solution

  • I had a similar problem. Currently it cannot be done without writing a new Map object type. So I've changed approach completely and done the following:-

    This has given me all the flexibility I need on the map as Leaflet is easy to configure and extend whilst allowing me to write the rest of the desktop app in Qt