diff --git a/platform/qt/src/qmapboxgl.cpp b/platform/qt/src/qmapboxgl.cpp index 0bfc6abf7..64431e233 100644 --- a/platform/qt/src/qmapboxgl.cpp +++ b/platform/qt/src/qmapboxgl.cpp @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -1295,7 +1296,7 @@ bool QMapboxGL::sourceExists(const QString& sourceID) Updates the source \a id with new \a params. If the source does not exist, it will be added like in addSource(). Only - GeoJSON sources can be updated. + image and GeoJSON sources can be updated. */ void QMapboxGL::updateSource(const QString &id, const QVariantMap ¶ms) { @@ -1309,12 +1310,17 @@ void QMapboxGL::updateSource(const QString &id, const QVariantMap ¶ms) } auto sourceGeoJSON = source->as(); - if (!sourceGeoJSON) { - qWarning() << "Unable to update source: only GeoJSON sources are mutable."; + auto sourceImage = source->as(); + if (!sourceGeoJSON && !sourceImage) { + qWarning() << "Unable to update source: only GeoJSON and Image sources are mutable."; return; } - if (params.contains("data")) { + if (sourceImage) { + if (params.contains("url")) { + sourceImage->setURL(params["url"].toString().toStdString()); + } + } else if (sourceGeoJSON && params.contains("data")) { Error error; auto result = convert(params["data"], error); if (result) {