diff --git a/src/core/symbology/qgsstylemodel.cpp b/src/core/symbology/qgsstylemodel.cpp index 75551132cf9..a5792e25a10 100644 --- a/src/core/symbology/qgsstylemodel.cpp +++ b/src/core/symbology/qgsstylemodel.cpp @@ -18,6 +18,7 @@ #include "qgssymbollayerutils.h" #include "qgsapplication.h" #include "qgssvgcache.h" +#include "qgsimagecache.h" #include const double ICON_PADDING_FACTOR = 0.16; @@ -41,12 +42,13 @@ QgsStyleModel::QgsStyleModel( QgsStyle *style, QObject *parent ) connect( mStyle, &QgsStyle::entityTagsChanged, this, &QgsStyleModel::onTagsChanged ); - // when a remote svg has been fetched, update the model's decorations. + // when a remote svg or image has been fetched, update the model's decorations. // this is required if a symbol utilizes remote svgs, and the current icons // have been generated using the temporary "downloading" svg. In this case // we require the preview to be regenerated to use the correct fetched // svg connect( QgsApplication::svgCache(), &QgsSvgCache::remoteSvgFetched, this, &QgsStyleModel::rebuildSymbolIcons ); + connect( QgsApplication::imageCache(), &QgsImageCache::remoteImageFetched, this, &QgsStyleModel::rebuildSymbolIcons ); } QVariant QgsStyleModel::data( const QModelIndex &index, int role ) const diff --git a/src/gui/qgsmapcanvas.cpp b/src/gui/qgsmapcanvas.cpp index 1075331039e..d4b2d2cf9ca 100644 --- a/src/gui/qgsmapcanvas.cpp +++ b/src/gui/qgsmapcanvas.cpp @@ -68,6 +68,7 @@ email : sherman at mrcc.com #include "qgsmapthemecollection.h" #include "qgscoordinatetransformcontext.h" #include "qgssvgcache.h" +#include "qgsimagecache.h" #include /** @@ -151,8 +152,9 @@ QgsMapCanvas::QgsMapCanvas( QWidget *parent ) refresh(); } ); - // refresh canvas when a remote svg has finished downloading + // refresh canvas when a remote svg/image has finished downloading connect( QgsApplication::svgCache(), &QgsSvgCache::remoteSvgFetched, this, &QgsMapCanvas::refreshAllLayers ); + connect( QgsApplication::imageCache(), &QgsImageCache::remoteImageFetched, this, &QgsMapCanvas::refreshAllLayers ); //segmentation parameters QgsSettings settings; diff --git a/src/gui/symbology/qgssymbolselectordialog.cpp b/src/gui/symbology/qgssymbolselectordialog.cpp index e27b3ed1c95..b72217e1328 100644 --- a/src/gui/symbology/qgssymbolselectordialog.cpp +++ b/src/gui/symbology/qgssymbolselectordialog.cpp @@ -34,6 +34,7 @@ #include "qgsfeatureiterator.h" #include "qgsvectorlayer.h" #include "qgssvgcache.h" +#include "qgsimagecache.h" #include #include @@ -303,6 +304,16 @@ QgsSymbolSelectorWidget::QgsSymbolSelectorWidget( QgsSymbol *symbol, QgsStyle *s symbolChanged(); updatePreview(); } ); + connect( QgsApplication::imageCache(), &QgsImageCache::remoteImageFetched, this, [ = ] + { + // when a remote image has been fetched, update the widget's previews + // this is required if the symbol utilizes remote images, and the current previews + // have been generated using the temporary "downloading" image. In this case + // we require the preview to be regenerated to use the correct fetched + // image + symbolChanged(); + updatePreview(); + } ); } QMenu *QgsSymbolSelectorWidget::advancedMenu()