[Qt] Allow setting the style via QML

This commit is contained in:
Thiago Marcos P. Santos
2016-04-28 19:43:24 +03:00
parent c8d6540bc1
commit da653ec537
4 changed files with 38 additions and 1 deletions

View File

@@ -42,7 +42,6 @@ void QQuickMapboxGLRenderer::render()
void QQuickMapboxGLRenderer::synchronize(QQuickFramebufferObject *item)
{
if (!m_initialized) {
m_map->setStyleURL(QMapbox::defaultStyles()[0].first);
QObject::connect(m_map.data(), SIGNAL(needsRendering()), item, SLOT(update()));
m_initialized = true;
}
@@ -58,4 +57,8 @@ void QQuickMapboxGLRenderer::synchronize(QQuickFramebufferObject *item)
const auto& center = quickMap->center();
m_map->setCoordinate(QMapbox::Coordinate(center.latitude(), center.longitude()));
}
if (syncStatus & QQuickMapboxGL::StyleNeedsSync) {
m_map->setStyleURL(quickMap->style());
}
}