diff options
Diffstat (limited to 'src/location/declarativemaps/qdeclarativegeoroutemodel.cpp')
-rw-r--r-- | src/location/declarativemaps/qdeclarativegeoroutemodel.cpp | 37 |
1 files changed, 31 insertions, 6 deletions
diff --git a/src/location/declarativemaps/qdeclarativegeoroutemodel.cpp b/src/location/declarativemaps/qdeclarativegeoroutemodel.cpp index 20ccfdd2..4be64642 100644 --- a/src/location/declarativemaps/qdeclarativegeoroutemodel.cpp +++ b/src/location/declarativemaps/qdeclarativegeoroutemodel.cpp @@ -115,8 +115,8 @@ static QList<QVariantMap> waypointMetadata(const QList<QDeclarativeGeoWaypoint * geographic routes from a backend provider. Routes include data about driving directions between two points, walking directions with multiple waypoints, and various other similar concepts. It functions much like other Model - types in QML (see for example \l {Models and Views in Qt Quick#Models}{ListModel} and - \l XmlListModel), and interacts with views such as \l MapItemView, and \l{ListView}. + types in QML (see for example \l {Models and Views in Qt Quick#Models}{ListModel}), + and interacts with views such as \l MapItemView, and \l{ListView}. Like \l Map and \l GeocodeModel, all the data for a RouteModel to work comes from a services plugin. This is contained in the \l{plugin} property, and @@ -273,7 +273,7 @@ void QDeclarativeGeoRouteModel::componentComplete() */ int QDeclarativeGeoRouteModel::rowCount(const QModelIndex &parent) const { - Q_UNUSED(parent) + Q_UNUSED(parent); return routes_.count(); } @@ -345,9 +345,9 @@ void QDeclarativeGeoRouteModel::pluginReady() QGeoServiceProvider *serviceProvider = plugin_->sharedGeoServiceProvider(); QGeoRoutingManager *routingManager = serviceProvider->routingManager(); - if (serviceProvider->error() != QGeoServiceProvider::NoError) { + if (serviceProvider->routingError() != QGeoServiceProvider::NoError) { QDeclarativeGeoRouteModel::RouteError newError = UnknownError; - switch (serviceProvider->error()) { + switch (serviceProvider->routingError()) { case QGeoServiceProvider::NotSupportedError: newError = EngineNotSetError; break; case QGeoServiceProvider::UnknownParameterError: @@ -360,7 +360,7 @@ void QDeclarativeGeoRouteModel::pluginReady() break; } - setError(newError, serviceProvider->errorString()); + setError(newError, serviceProvider->routingErrorString()); return; } @@ -1446,6 +1446,31 @@ QDeclarativeGeoRouteQuery::RouteOptimizations QDeclarativeGeoRouteQuery::routeOp return optimization; } +/*! + \qmlproperty date RouteQuery::departureTime + + The departure time to be used when querying for the route. + The default value is an invalid date, meaning no departure time will be used in the query. + + \since 5.13 +*/ +void QDeclarativeGeoRouteQuery::setDepartureTime(const QDateTime &departureTime) +{ + if (departureTime == request_.departureTime()) + return; + + request_.setDepartureTime(departureTime); + if (complete_) { + emit departureTimeChanged(); + emit queryDetailsChanged(); + } +} + +QDateTime QDeclarativeGeoRouteQuery::departureTime() const +{ + return request_.departureTime(); +} + void QDeclarativeGeoRouteQuery::setRouteOptimizations(QDeclarativeGeoRouteQuery::RouteOptimizations optimization) { QGeoRouteRequest::RouteOptimizations reqOptimizations; |