[QT][QML][MapView] TravelModes doesn't work
-
Dear users,
as mentioned in object I have a simple QT application with a QML view and inside to this view I have a MapView with a route inside. All works correctly, except the travelmodes parameter. By this parameter is possible to choose the way to travel; but if I set different values, the route remains the same. No output error I see on the QT console. I copy the map code below; I think, the rest of the app is correct because the map (and also the route) appears correctly.My purpose is, show a route as a series of segment and not as the curve decided from the navigator; in other words, simply lines between my waypoints.
This is the link explaining the travelModes paramater (see "example usage paragraph):
https://doc.qt.io/qt-5/qml-qtlocation-routemodel.html
This is the code of my QML view:
import QtQuick 2.0 import QtQuick.Window 2.0 import QtLocation 5.6 import QtPositioning 5.6 Window { width: 512 height: 512 visible: true Plugin { id: osmPlugin name: "osm" } Map { anchors.fill: parent plugin: osmPlugin center: QtPositioning.coordinate(60.170448, 24.942046) // Oslo zoomLevel: 6 copyrightsVisible: false RouteModel { id: rm plugin: osmPlugin query: RouteQuery {id: routeQuery } Component.onCompleted: { routeQuery.addWaypoint(QtPositioning.coordinate(60.170448, 24.942046)); routeQuery.addWaypoint(QtPositioning.coordinate(62.170448, 23.942046)); routeQuery.addWaypoint(QtPositioning.coordinate(63.170448, 27.942046)); //Why this row doesn't work? routeQuery.travelModes = RouteQuery.BasicSegmentData; rm.update(); } } MapItemView { model: rm delegate: Component{ MapRoute { route: routeData line.color: "green" line.width: 3 smooth: false opacity: 0.8 } } } } }