Display different routes for different start/end points using Qt Locations



  • I'm trying to display different routes that have different start and end points. There'e no relations between them. but I couldn't achieve that using multiple RouteModels like this:

    RouteModel {
        id: rm
        plugin: somePlugin
        query: RouteQuery {}
        Component.onCompleted: {
            query.addWaypoint(QtPositioning.coordinate(26.291584, 50.199094));
            query.addWaypoint(QtPositioning.coordinate(26.288128, 50.188725));
        }
    }
    
    RouteModel {
        id: rm1
        plugin: somePlugin
        query: RouteQuery {}
        Component.onCompleted: {
            query.addWaypoint(QtPositioning.coordinate(26.278496, 50.203740));
            query.addWaypoint(QtPositioning.coordinate(26.272351, 50.185939));
            rm1.update();
        }
    }
    
    Map {
        id: map
        anchors.fill: parent
        plugin: somePlugin
        center: magione
        gesture.enabled: true
        zoomLevel: 13
    
        MapItemView {
            model: rm
            delegate: MapRoute {
                route: routeData
                line.color: "green"
                line.width: 5
                smooth: true
            }
        }
    
        MapItemView {
            model: rm1
            delegate: MapRoute {
                route: routeData
                line.color: "red"
                line.width: 5
                smooth: true
            }
        }
    }
    

    But only the last RouteModel is the one that shows! I want both to display simultaneously, any idea how can I achieve that?