[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

@@ -3,6 +3,7 @@
#include <QQuickMapboxGL>
#include <QQuickItem>
#include <QString>
#include <QtGlobal>
QQuickMapboxGL::QQuickMapboxGL(QQuickItem *parent_)
@@ -156,6 +157,25 @@ QColor QQuickMapboxGL::color() const
return QColor();
}
void QQuickMapboxGL::setStyle(const QString &styleUrl)
{
if (m_style == styleUrl) {
return;
}
m_style = styleUrl;
m_syncState |= StyleNeedsSync;
update();
emit styleChanged();
}
QString QQuickMapboxGL::style() const
{
return m_style;
}
int QQuickMapboxGL::swapSyncState()
{
int oldState = m_syncState;