From 37fd1d8a970870698b887cc3e7aa7f2864bfafcb Mon Sep 17 00:00:00 2001 From: Paolo Angelelli Date: Wed, 14 Jun 2017 15:08:18 +0200 Subject: 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 Reviewed-by: Alex Blasche --- src/plugins/geoservices/mapboxgl/qgeomapmapboxgl.cpp | 6 +++--- src/plugins/geoservices/mapboxgl/qmapboxglstylechange.cpp | 3 ++- 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 -- cgit v1.2.1