summaryrefslogtreecommitdiff
path: root/src/plugins/geoservices
diff options
context:
space:
mode:
authorPaolo Angelelli <paolo.angelelli@qt.io>2017-12-21 17:28:10 +0100
committerPaolo Angelelli <paolo.angelelli@qt.io>2018-01-11 14:42:22 +0000
commita511cdcc0f47f3c9254e361c6cc7e4ea6f98529f (patch)
tree3838fa949da0186ba7c2490f92600cfdb70fc21e /src/plugins/geoservices
parent0c00f73cebfcfe4308d46c67a6f3345886b9bccb (diff)
downloadqtlocation-a511cdcc0f47f3c9254e361c6cc7e4ea6f98529f.tar.gz
OSM Places: support query limit parameter
Change-Id: I9d5b5b547c5932270e0c1f68a21253b01e1d52cc Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'src/plugins/geoservices')
-rw-r--r--src/plugins/geoservices/osm/qplacemanagerengineosm.cpp6
-rw-r--r--src/plugins/geoservices/osm/qplacemanagerengineosm.h1
2 files changed, 7 insertions, 0 deletions
diff --git a/src/plugins/geoservices/osm/qplacemanagerengineosm.cpp b/src/plugins/geoservices/osm/qplacemanagerengineosm.cpp
index 01398346..7e1a2f6c 100644
--- a/src/plugins/geoservices/osm/qplacemanagerengineosm.cpp
+++ b/src/plugins/geoservices/osm/qplacemanagerengineosm.cpp
@@ -112,6 +112,10 @@ QPlaceManagerEngineOsm::QPlaceManagerEngineOsm(const QVariantMap &parameters,
if (parameters.contains(QStringLiteral("osm.places.debug_query")))
m_debugQuery = parameters.value(QStringLiteral("osm.places.debug_query")).toBool();
+ if (parameters.contains(QStringLiteral("osm.places.page_size"))
+ && parameters.value(QStringLiteral("osm.places.page_size")).canConvert<int>())
+ m_pageSize = parameters.value(QStringLiteral("osm.places.page_size")).toInt();
+
*error = QGeoServiceProvider::NoError;
errorString->clear();
}
@@ -171,6 +175,8 @@ QPlaceSearchReply *QPlaceManagerEngineOsm::search(const QPlaceSearchRequest &req
queryItems.addQueryItem(QStringLiteral("exclude_place_ids"), placeIds.join(QLatin1Char(',')));
queryItems.addQueryItem(QStringLiteral("addressdetails"), QStringLiteral("1"));
+ queryItems.addQueryItem(QStringLiteral("limit"), (request.limit() > 0) ? QString::number(request.limit())
+ : QString::number(m_pageSize));
QUrl requestUrl(m_urlPrefix);
requestUrl.setQuery(queryItems);
diff --git a/src/plugins/geoservices/osm/qplacemanagerengineosm.h b/src/plugins/geoservices/osm/qplacemanagerengineosm.h
index 3cbc7281..76898dad 100644
--- a/src/plugins/geoservices/osm/qplacemanagerengineosm.h
+++ b/src/plugins/geoservices/osm/qplacemanagerengineosm.h
@@ -84,6 +84,7 @@ private:
QString m_urlPrefix;
QList<QLocale> m_locales;
bool m_debugQuery = false;
+ int m_pageSize = 50; // the default page size of the public nominatim server
QNetworkReply *m_categoriesReply;
QList<QPlaceCategoriesReplyOsm *> m_pendingCategoriesReply;