routeSegment QML Type

The routeSegment type represents a segment of a Route. More...

Import Statement: import QtLocation 6.7
Since: QtLocation 5.5


Detailed Description

A routeSegment instance has information about the physical layout of the route segment, the length of the route and estimated time required to traverse the route segment and optional routeManeuvers associated with the end of the route segment.

Instances of routeSegment can be thought of as edges on a routing graph, with routeManeuver instances as optional labels attached to the vertices of the graph.

The primary means of acquiring Route objects is via Routes via RouteModel.


The following QML snippet demonstrates how to print information about a route segment:

import QtQuick
import QtPositioning
import QtLocation

Text {
    text: "Segment distance " + routeSegment.distance + " meters, " + routeSegment.path.length + " points."

Property Documentation

distance : real

Read-only property which holds the distance covered by this segment of the route, in meters.

maneuver : RouteManeuver

Read-only property which holds the maneuver for this route segment.

Will return invalid maneuver if no information has been attached to the endpoint of this route segment.

path : list<coordinate>

Read-only property which holds the geographical coordinates of this segment. Coordinates are listed in the order in which they would be traversed by someone traveling along this segment of the route.

To access individual segments you can use standard list accessors: 'path.length' indicates the number of objects and 'path[index starting from zero]' gives the actual object.

See also QtPositioning::coordinate.

travelTime : int

Read-only property which holds the estimated amount of time it will take to traverse this segment, in seconds.

© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.