Unsolved MapItemView does not show Route
-
Hi,
I was playing around with QtQuick Maps and stuff and tried to display a route on a Map. I was able to do basic things like displaying the Map, centering it on a specific coordinate, zooming it and so on without much trouble, but displaying a Route just won't work.
As far as I understood the documentation, what I did should work. But the docs are not super detailed about this topic.
I reduced my code to a minimal example, which should just display a small route in Berlin:
import QtQuick 2.7 import QtQuick.Controls 2.0 import QtQuick.Layouts 1.0 import QtLocation 5.3 import QtPositioning 5.3 ApplicationWindow { visible: true width: 1000 height: 700 Plugin { id: thePlugin name: "mapbox" PluginParameter { name: "mapbox.access_token" value: "MY_PRIVATE_MAPBOX_KEY" } PluginParameter { name: "mapbox.map_id" value: "mapbox.mapbox-streets-v6" } } Map { id: theMap plugin: thePlugin anchors.fill: parent zoomLevel: maximumZoomLevel - 2 center: QtPositioning.coordinate(52.5152725, 13.3774632) RouteQuery { id: rQuery } RouteModel { id: rModel plugin: thePlugin query: rQuery } Component { id: rDelegate MapRoute { route: routeData line.color: "yellow" line.width: 10 smooth: true } } MapItemView { model: rModel delegate: rDelegate Component.onCompleted: { rQuery.clearWaypoints(); rQuery.addWaypoint(QtPositioning.coordinate(52.5152725, 13.3774632)); rQuery.addWaypoint(QtPositioning.coordinate(52.5196863, 13.4040609)); rQuery.travelModes = RouteQuery.PedestrianTravel; rModel.update(); } } } }
I'd be glad, if somebody could have a look and tell me what I'm doing wrong...