summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Shaw <andy.shaw@qt.io>2018-10-19 09:24:36 +0200
committerAndy Shaw <andy.shaw@qt.io>2018-11-06 10:29:32 +0000
commitee700d2eeb4508aa5356ddef11bf11964c5d9283 (patch)
tree1f0945862177ac1fd547b7aae543d9be4107f886
parent6b109d09982e09940dc8e777430a04410d7b6550 (diff)
downloadqtlocation-ee700d2eeb4508aa5356ddef11bf11964c5d9283.tar.gz
Mapbox: Only include matching categories in the results
If an entry in the results had no categories specified at all then it would end up including this in the results even if a specific category was requested to match against. Change-Id: I506b40b73ec07608bd2b2562d92065376fbb67c9 Reviewed-by: Paolo Angelelli <paolo.angelelli@qt.io>
-rw-r--r--src/plugins/geoservices/mapbox/qplacesearchreplymapbox.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/plugins/geoservices/mapbox/qplacesearchreplymapbox.cpp b/src/plugins/geoservices/mapbox/qplacesearchreplymapbox.cpp
index a79af1cb..b2f2f043 100644
--- a/src/plugins/geoservices/mapbox/qplacesearchreplymapbox.cpp
+++ b/src/plugins/geoservices/mapbox/qplacesearchreplymapbox.cpp
@@ -188,19 +188,18 @@ void QPlaceSearchReplyMapbox::onReplyFinished()
if (!categories.isEmpty()) {
const QList<QPlaceCategory> placeCategories = placeResult.place().categories();
+ bool categoryMatch = false;
if (!placeCategories.isEmpty()) {
- bool categoryMatch = false;
for (const QPlaceCategory &placeCategory : placeCategories) {
if (categories.contains(placeCategory)) {
categoryMatch = true;
break;
}
}
- if (!categoryMatch)
- continue;
}
+ if (!categoryMatch)
+ continue;
}
-
placeResult.setDistance(searchCenter.distanceTo(placeResult.place().location().coordinate()));
results.append(placeResult);
}