[Qt] Use MapChangeWillStartLoadingMap to get notified about style changes

This commit is contained in:
Bruno de Oliveira Abinader
2016-08-05 11:44:43 +03:00
parent ee62a807a3
commit 45da1abbe1
5 changed files with 40 additions and 4 deletions

View File

@@ -23,7 +23,9 @@ QQuickMapboxGL::~QQuickMapboxGL()
QQuickFramebufferObject::Renderer *QQuickMapboxGL::createRenderer() const
{
return new QQuickMapboxGLRenderer();
QQuickMapboxGLRenderer *renderer = new QQuickMapboxGLRenderer();
connect(renderer, SIGNAL(styleChanged()), this, SIGNAL(styleChanged()));
return renderer;
}
void QQuickMapboxGL::setPlugin(QDeclarativeGeoServiceProvider *)
@@ -267,11 +269,13 @@ void QQuickMapboxGL::itemChange(QQuickItem::ItemChange change, const QQuickItem:
case QQuickItem::ItemChildAddedChange:
if (QQuickMapboxGLStyleProperty *property = qobject_cast<QQuickMapboxGLStyleProperty *>(value.item)) {
connect(property, SIGNAL(updated(QVariantMap)), this, SLOT(onStylePropertyUpdated(QVariantMap)));
connect(this, SIGNAL(styleChanged()), property, SLOT(checkUpdated()));
}
break;
case QQuickItem::ItemChildRemovedChange:
if (QQuickMapboxGLStyleProperty *property = qobject_cast<QQuickMapboxGLStyleProperty *>(value.item)) {
disconnect(property, SIGNAL(updated(QVariantMap)), this, SLOT(onStylePropertyUpdated(QVariantMap)));
disconnect(this, SIGNAL(styleChanged()), property, SLOT(checkUpdated()));
}
default:
break;