summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Leung <alex.leung@thalmic.com>2020-03-03 10:25:48 -0500
committerAlex Leung <alex.leung@thalmic.com>2020-03-24 18:12:31 -0500
commitf16f4a231cd10867c10eb42fb456867469c93836 (patch)
tree5e0bf9a52353ccc3051568ce6e2a80bf065e7b37
parenta0e88ed10cd07d4bdf79d7e7f05f01179f2eb296 (diff)
downloadqtlocation-f16f4a231cd10867c10eb42fb456867469c93836.tar.gz
Support custom Mapbox API base URLs
Added support for custom Mapbox API base URLs. Fixes: QTBUG-82655 Change-Id: Ieebcc834f8aeaeb223b036100e5edadd55749101 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
-rw-r--r--src/location/doc/src/plugins/mapboxgl.qdoc4
-rw-r--r--src/plugins/geoservices/mapboxgl/qgeomappingmanagerenginemapboxgl.cpp5
2 files changed, 9 insertions, 0 deletions
diff --git a/src/location/doc/src/plugins/mapboxgl.qdoc b/src/location/doc/src/plugins/mapboxgl.qdoc
index 119868d1..f2cea8e8 100644
--- a/src/location/doc/src/plugins/mapboxgl.qdoc
+++ b/src/location/doc/src/plugins/mapboxgl.qdoc
@@ -88,6 +88,10 @@ The following table lists optional parameters that can be passed to the Mapbox p
\l{https://www.mapbox.com/tos}{Terms of Services} and must not be used in production. This property has
no effect on styles hosted outside the Mapbox servers.
\row
+ \li mapboxgl.api_base_url
+ \li Set a custom API base URL. When not set, the URL defaults to \l{https://api.mapbox.com}.
+ This parameter is ignored if the the \b mapboxgl.china property is set.
+\row
\li mapboxgl.china
\li Use Mapbox China API base URLs and styles.
Please notice that Mapbox China requires a specific access token. Contact \l
diff --git a/src/plugins/geoservices/mapboxgl/qgeomappingmanagerenginemapboxgl.cpp b/src/plugins/geoservices/mapboxgl/qgeomappingmanagerenginemapboxgl.cpp
index 5cbde041..cde7871e 100644
--- a/src/plugins/geoservices/mapboxgl/qgeomappingmanagerenginemapboxgl.cpp
+++ b/src/plugins/geoservices/mapboxgl/qgeomappingmanagerenginemapboxgl.cpp
@@ -73,6 +73,11 @@ QGeoMappingManagerEngineMapboxGL::QGeoMappingManagerEngineMapboxGL(const QVarian
m_useChinaEndpoint = parameters.value(QStringLiteral("mapboxgl.china")).toBool();
}
+ if (parameters.contains(QStringLiteral("mapboxgl.api_base_url"))) {
+ const QString apiBaseUrl = parameters.value(QStringLiteral("mapboxgl.api_base_url")).toString();
+ m_settings.setApiBaseUrl(apiBaseUrl);
+ }
+
QVariantMap metadata;
metadata["isHTTPS"] = true;