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][QML][MapView] TravelModes doesn't work
Forum Updated to NodeBB v4.3 + New Features

[QT][QML][MapView] TravelModes doesn't work

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 143 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 Shadow.01
    #1

    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
    
    
                      }
                  }
              }
          }
      }
    
    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