Qt Map create Multiple Polylines ( Not linked to each other )
Unsolved
QML and Qt Quick
-
iam tryin to create multiple polylines on the map, but should not be linked to each other.
i used ListModel and MapItemView as follows:ListModel{ id: linesModel } MapItemView { id: lineModelView model: linesModel delegate: MapPolyline { line.width: 3 line.color: "red" path: model.path } }
with mouse click i put the points on the map into array
property var polyCoords : []
onClicked(){ var point = map.toCoordinate(Qt.point(mouse.x,mouse.y)); polyCoords.push(point) }
then i handle key click Key_P to put points into lines model:
if(event.key === Qt.Key_P){ console.log(polyCoords) var newLine = { "path": polyCoords } linesModel.append(newLine) }
but the polyline does not appear on the map, what should i do in this case ?