1616#include " qgsstylemodel.h"
1717#include " qgsstyle.h"
1818#include " qgssymbollayerutils.h"
19+ #include " qgsapplication.h"
20+ #include " qgssvgcache.h"
1921#include < QIcon>
2022
2123const double ICON_PADDING_FACTOR = 0.16 ;
@@ -38,6 +40,13 @@ QgsStyleModel::QgsStyleModel( QgsStyle *style, QObject *parent )
3840 connect ( mStyle , &QgsStyle::rampRenamed, this , &QgsStyleModel::onRampRename );
3941
4042 connect ( mStyle , &QgsStyle::entityTagsChanged, this , &QgsStyleModel::onTagsChanged );
43+
44+ // when a remote svg has been fetched, update the model's decorations.
45+ // this is required if a symbol utilizes remote svgs, and the current icons
46+ // have been generated using the temporary "downloading" svg. In this case
47+ // we require the preview to be regenerated to use the correct fetched
48+ // svg
49+ connect ( QgsApplication::svgCache (), &QgsSvgCache::remoteSvgFetched, this , &QgsStyleModel::rebuildSymbolIcons );
4150}
4251
4352QVariant QgsStyleModel::data ( const QModelIndex &index, int role ) const
@@ -403,6 +412,12 @@ void QgsStyleModel::onTagsChanged( int entity, const QString &name, const QStrin
403412 emit dataChanged ( i, i );
404413}
405414
415+ void QgsStyleModel::rebuildSymbolIcons ()
416+ {
417+ mSymbolIconCache .clear ();
418+ emit dataChanged ( index ( 0 , 0 ), index ( mSymbolNames .count () - 1 , 0 ), QVector<int >() << Qt::DecorationRole );
419+ }
420+
406421//
407422// QgsStyleProxyModel
408423//
0 commit comments