summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaolo Angelelli <paolo.angelelli@qt.io>2017-06-14 15:08:18 +0200
committerPaolo Angelelli <paolo.angelelli@qt.io>2017-06-18 08:04:45 +0000
commit37fd1d8a970870698b887cc3e7aa7f2864bfafcb (patch)
treefb0c3eebbea5244764ced7ddbf97140139ac2385
parentc0683791e467e75067ec1948952528a1ba998710 (diff)
Use QDeclarativeGeoMapItemBase objectName to create mapboxgl item id
With this patch is now possible to predict what's the layer name that the mapboxgl plugin is generating for a specific map item, if that item has the objectName set. Change-Id: I7726e44c6b0cc981d30e7725326075025f49af30 Reviewed-by: Thiago Marcos P. Santos <tmpsantos@gmail.com> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
-rw-r--r--src/plugins/geoservices/mapboxgl/qgeomapmapboxgl.cpp6
-rw-r--r--src/plugins/geoservices/mapboxgl/qmapboxglstylechange.cpp3
2 files changed, 5 insertions, 4 deletions
diff --git a/src/plugins/geoservices/mapboxgl/qgeomapmapboxgl.cpp b/src/plugins/geoservices/mapboxgl/qgeomapmapboxgl.cpp
index 82378f0a..3b9026ce 100644
--- a/src/plugins/geoservices/mapboxgl/qgeomapmapboxgl.cpp
+++ b/src/plugins/geoservices/mapboxgl/qgeomapmapboxgl.cpp
@@ -364,11 +364,11 @@ void QGeoMapMapboxGL::onMapChanged(QMapboxGL::MapChange change)
d->m_styleLoaded = false;
d->m_styleChanges.clear();
- for (QGeoMapParameter *param : d->m_mapParameters)
- d->m_styleChanges << QMapboxGLStyleChange::addMapParameter(param);
-
for (QDeclarativeGeoMapItemBase *item : d->m_mapItems)
d->m_styleChanges << QMapboxGLStyleChange::addMapItem(item, d->m_mapItemsBefore);
+
+ for (QGeoMapParameter *param : d->m_mapParameters)
+ d->m_styleChanges << QMapboxGLStyleChange::addMapParameter(param);
}
}
diff --git a/src/plugins/geoservices/mapboxgl/qmapboxglstylechange.cpp b/src/plugins/geoservices/mapboxgl/qmapboxglstylechange.cpp
index 8229b784..c6972b07 100644
--- a/src/plugins/geoservices/mapboxgl/qmapboxglstylechange.cpp
+++ b/src/plugins/geoservices/mapboxgl/qmapboxglstylechange.cpp
@@ -59,7 +59,8 @@ bool isImmutableProperty(const QString &name)
QString getId(QDeclarativeGeoMapItemBase *mapItem)
{
- return QStringLiteral("QDeclarativeGeoMapItemBase-") + QString::number(quint64(mapItem));
+ return QStringLiteral("QtLocation-") +
+ ((mapItem->objectName().isEmpty()) ? QString::number(quint64(mapItem)) : mapItem->objectName());
}
// Mapbox GL supports geometry segments that spans above 180 degrees in