[Qt] Make needsRendering signal asynchronous

Fixes label animation not completing.
This commit is contained in:
Thiago Marcos P. Santos
2016-04-28 15:04:03 +03:00
parent 94093493d5
commit a9327c07e7
2 changed files with 8 additions and 2 deletions

View File

@@ -561,6 +561,7 @@ void QMapboxGL::removeCustomLayer(const QString& id)
void QMapboxGL::render()
{
d_ptr->dirty = false;
d_ptr->mapObj->render();
}
@@ -584,7 +585,7 @@ QMapboxGLPrivate::QMapboxGLPrivate(QMapboxGL *q, const QMapboxGLSettings &settin
static_cast<mbgl::ConstrainMode>(settings.constrainMode())))
{
fileSourceObj->setAccessToken(settings.accessToken().toStdString());
connect(this, SIGNAL(needsRendering()), q_ptr, SIGNAL(needsRendering()));
connect(this, SIGNAL(needsRendering()), q_ptr, SIGNAL(needsRendering()), Qt::QueuedConnection);
connect(this, SIGNAL(mapRegionDidChange()), q_ptr, SIGNAL(mapRegionDidChange()));
}
@@ -610,7 +611,10 @@ std::array<uint16_t, 2> QMapboxGLPrivate::getFramebufferSize() const
void QMapboxGLPrivate::invalidate()
{
emit needsRendering();
if (!dirty) {
emit needsRendering();
dirty = true;
}
}
void QMapboxGLPrivate::notifyMapChange(mbgl::MapChange change)

View File

@@ -44,6 +44,8 @@ public:
std::unique_ptr<mbgl::DefaultFileSource> fileSourceObj;
std::unique_ptr<mbgl::Map> mapObj;
bool dirty = false;
public slots:
void connectionEstablished();