summaryrefslogtreecommitdiff
path: root/src/imports/location
diff options
context:
space:
mode:
authorAlex Wilson <alex.wilson@nokia.com>2012-02-14 15:18:31 +1000
committerQt by Nokia <qt-info@nokia.com>2012-02-15 02:39:38 +0100
commitd6fcb7406a24b2de3ca6c823b41356bcb23fb959 (patch)
tree6a1e1495a9635ffafaefa1d10386bc56bfe15cf9 /src/imports/location
parent16c782e1ef2e84baaadeb498ec3b90b2a0fa065e (diff)
downloadqtlocation-d6fcb7406a24b2de3ca6c823b41356bcb23fb959.tar.gz
Add resetFeatureWeights() function to RouteQuery
Task-number: QTBUG-20840 Change-Id: Id758f38288477f4cb12ae5ef112d5aecdf7ce9df Reviewed-by: Natalia Shubina <natalia.shubina@nokia.com> Reviewed-by: David Laing <david.laing@nokia.com>
Diffstat (limited to 'src/imports/location')
-rw-r--r--src/imports/location/qdeclarativegeoroutemodel.cpp31
-rw-r--r--src/imports/location/qdeclarativegeoroutemodel_p.h1
2 files changed, 22 insertions, 10 deletions
diff --git a/src/imports/location/qdeclarativegeoroutemodel.cpp b/src/imports/location/qdeclarativegeoroutemodel.cpp
index 46a7bce2..55920a89 100644
--- a/src/imports/location/qdeclarativegeoroutemodel.cpp
+++ b/src/imports/location/qdeclarativegeoroutemodel.cpp
@@ -866,7 +866,8 @@ void QDeclarativeGeoRouteQuery::clearWaypoints()
/*!
\qmlmethod QtLocation5::RouteModel::setFeatureWeight(FeatureType, FeatureWeight)
- Defines the weight to associate with a feature during the planning of a route.
+ Defines the weight to associate with a feature during the planning of a
+ route.
Following lists the possible feature weights:
@@ -885,15 +886,7 @@ void QDeclarativeGeoRouteQuery::clearWaypoints()
void QDeclarativeGeoRouteQuery::setFeatureWeight(FeatureType featureType, FeatureWeight featureWeight)
{
if (featureType == NoFeature && !request_.featureTypes().isEmpty()) {
- // reset all feature types.
- QList<QGeoRouteRequest::FeatureType> featureTypes = request_.featureTypes();
- for (int i = 0; i < featureTypes.count(); ++i) {
- request_.setFeatureWeight(featureTypes.at(i), QGeoRouteRequest::NeutralFeatureWeight);
- }
- if (complete_) {
- emit featureTypesChanged();
- emit queryDetailsChanged();
- }
+ resetFeatureWeights();
return;
}
@@ -912,6 +905,24 @@ void QDeclarativeGeoRouteQuery::setFeatureWeight(FeatureType featureType, Featur
}
}
+/*!
+ \qmlmethod QtLocation5::RouteModel::resetFeatureWeights()
+
+ Resets all feature weights to their default state (NeutralFeatureWeight).
+*/
+void QDeclarativeGeoRouteQuery::resetFeatureWeights()
+{
+ // reset all feature types.
+ QList<QGeoRouteRequest::FeatureType> featureTypes = request_.featureTypes();
+ for (int i = 0; i < featureTypes.count(); ++i) {
+ request_.setFeatureWeight(featureTypes.at(i), QGeoRouteRequest::NeutralFeatureWeight);
+ }
+ if (complete_) {
+ emit featureTypesChanged();
+ emit queryDetailsChanged();
+ }
+}
+
int QDeclarativeGeoRouteQuery::featureWeight(FeatureType featureType)
{
return request_.featureWeight(static_cast<QGeoRouteRequest::FeatureType>(featureType));
diff --git a/src/imports/location/qdeclarativegeoroutemodel_p.h b/src/imports/location/qdeclarativegeoroutemodel_p.h
index ac284e68..1e2b97fc 100644
--- a/src/imports/location/qdeclarativegeoroutemodel_p.h
+++ b/src/imports/location/qdeclarativegeoroutemodel_p.h
@@ -274,6 +274,7 @@ public:
Q_INVOKABLE void setFeatureWeight(FeatureType featureType, FeatureWeight featureWeight);
Q_INVOKABLE int featureWeight(FeatureType featureType);
+ Q_INVOKABLE void resetFeatureWeights();
/*
feature weights