diff options
author | Andy Shaw <andy.shaw@qt.io> | 2018-10-19 09:24:36 +0200 |
---|---|---|
committer | Andy Shaw <andy.shaw@qt.io> | 2018-11-06 10:29:32 +0000 |
commit | ee700d2eeb4508aa5356ddef11bf11964c5d9283 (patch) | |
tree | 1f0945862177ac1fd547b7aae543d9be4107f886 /src | |
parent | 6b109d09982e09940dc8e777430a04410d7b6550 (diff) | |
download | qtlocation-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>
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/geoservices/mapbox/qplacesearchreplymapbox.cpp | 7 |
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); } |