[Qt] Fix panning the map not updating the center property

This commit is contained in:
Thiago Marcos P. Santos
2016-05-02 21:36:03 +03:00
parent d4070d3356
commit 7aa0a88c64
3 changed files with 19 additions and 5 deletions

View File

@@ -42,7 +42,11 @@ void QQuickMapboxGLRenderer::render()
void QQuickMapboxGLRenderer::synchronize(QQuickFramebufferObject *item)
{
if (!m_initialized) {
QObject::connect(m_map.data(), SIGNAL(needsRendering()), item, SLOT(update()));
auto qquickMapbox = static_cast<QQuickMapboxGL*>(item);
QObject::connect(m_map.data(), &QMapboxGL::needsRendering, qquickMapbox, &QQuickMapboxGL::update);
QObject::connect(this, &QQuickMapboxGLRenderer::centerChanged, qquickMapbox, &QQuickMapboxGL::setCenter);
m_initialized = true;
}
@@ -64,6 +68,7 @@ void QQuickMapboxGLRenderer::synchronize(QQuickFramebufferObject *item)
if (syncStatus & QQuickMapboxGL::PanNeedsSync) {
m_map->moveBy(quickMap->swapPan());
emit centerChanged(QGeoCoordinate(m_map->latitude(), m_map->longitude()));
}
if (syncStatus & QQuickMapboxGL::BearingNeedsSync) {