Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Qt Map create Multiple Polylines ( Not linked to each other )
Forum Updated to NodeBB v4.3 + New Features

Qt Map create Multiple Polylines ( Not linked to each other )

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 275 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Mohamad Ayrot
    wrote on last edited by
    #1

    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 ?

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved