Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [QT][QML][Mapbox] Route doesn't show
Qt 6.11 is out! See what's new in the release blog

[QT][QML][Mapbox] Route doesn't show

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 234 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.
  • S Offline
    S Offline
    Shadow.01
    wrote on last edited by
    #1

    Hi all,

    by following a part of this example

    https://stackoverflow.com/questions/49943303/display-multiple-routes-on-a-map-using-routemap-qml-qt

    I'm trying to show a route inside a MapView in a QML view of my QT application, by using the following code; but the route don't appear. No errors are appearing in the output console. Did I do something wrong? Thank you very much!

           Map {
                    anchors.fill: parent
                    plugin: mapboxglPlugin
                    center: QtPositioning.coordinate(60.170448, 24.942046) // Oslo
                    zoomLevel: 16
                    id: mapMain
                    copyrightsVisible: false
    
    
                    RouteModel {
                        id: rm
                        plugin: mapboxglPlugin
                        query: RouteQuery {id: routeQuery }
                        Component.onCompleted: {
                            routeQuery.addWaypoint(QtPositioning.coordinate(60.170448, 24.942046));
                            routeQuery.addWaypoint(QtPositioning.coordinate(62.170448, 23.942046));
                            update();
                        }
                    }
    
                    MapItemView {
                        model: rm
                        delegate: Component{
                            MapRoute {
                                route: routeData
                                line.color: "green"
                                line.width: 5
                                smooth: true
                            }
                        }
                    }
           }
    
    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