diff options
-rw-r--r-- | src/plugins/geoservices/osm/qplacemanagerengineosm.cpp | 3 | ||||
-rw-r--r-- | src/plugins/geoservices/osm/qplacesearchreplyosm.cpp | 14 |
2 files changed, 9 insertions, 8 deletions
diff --git a/src/plugins/geoservices/osm/qplacemanagerengineosm.cpp b/src/plugins/geoservices/osm/qplacemanagerengineosm.cpp index 6eb035b9..60bc55ff 100644 --- a/src/plugins/geoservices/osm/qplacemanagerengineosm.cpp +++ b/src/plugins/geoservices/osm/qplacemanagerengineosm.cpp @@ -129,9 +129,6 @@ QPlaceSearchReply *QPlaceManagerEngineOsm::search(const QPlaceSearchRequest &req for (const QPlaceCategory &category : request.categories()) { QString id = category.categoryId(); - int index = id.indexOf(QLatin1Char('=')); - if (index != -1) - id = id.mid(index+1); queryParts.append(QLatin1Char('[') + id + QLatin1Char(']')); } diff --git a/src/plugins/geoservices/osm/qplacesearchreplyosm.cpp b/src/plugins/geoservices/osm/qplacesearchreplyosm.cpp index 2f8e6fde..359d93f7 100644 --- a/src/plugins/geoservices/osm/qplacesearchreplyosm.cpp +++ b/src/plugins/geoservices/osm/qplacesearchreplyosm.cpp @@ -16,6 +16,7 @@ #include <QtLocation/QPlaceAttribute> #include <QtLocation/QPlaceIcon> #include <QtLocation/QPlaceResult> +#include <QtLocation/QPlaceCategory> #include <QtLocation/QPlaceSearchRequest> #include <QtLocation/private/qplacesearchrequest_p.h> @@ -150,8 +151,8 @@ QPlaceResult QPlaceSearchReplyOsm::parsePlaceResult(const QJsonObject &item) con item.value(QStringLiteral("lon")).toString().toDouble()); //const QString placeRank = item.value(QStringLiteral("place_rank")).toString(); - const QString category = item.value(QStringLiteral("category")).toString(); - // const QString type = item.value(QStringLiteral("type")).toString(); + const QString categoryName = item.value(QStringLiteral("category")).toString(); + const QString type = item.value(QStringLiteral("type")).toString(); //double importance = item.value(QStringLiteral("importance")).toDouble(); place.setAttribution(item.value(QStringLiteral("licence")).toString()); @@ -165,8 +166,7 @@ QPlaceResult QPlaceSearchReplyOsm::parsePlaceResult(const QJsonObject &item) con place.setIcon(icon); QJsonObject addressDetails = item.value(QStringLiteral("address")).toObject(); - - const QString title = addressDetails.value(category).toString(); + const QString title = addressDetails.value(categoryName).toString(); place.setName(title); @@ -192,9 +192,13 @@ QPlaceResult QPlaceSearchReplyOsm::parsePlaceResult(const QJsonObject &item) con location.setCoordinate(coordinate); location.setAddress(address); location.setBoundingShape(parseBoundingBox(item.value(QStringLiteral("boundingbox")).toArray())); - place.setLocation(location); + QPlaceCategory category; + category.setName(categoryName + "=" + type); + category.setCategoryId(categoryName + "=" + type); + place.setCategory(category); + QPlaceResult result; result.setIcon(icon); result.setPlace(place); |