Skip to content

Commit fba6a24

Browse files
committed
Update symbol selector when svg cache fetches remote images
(cherry-picked from 2e6a69b)
1 parent 9b7ef03 commit fba6a24

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

src/core/symbology/qgssvgcache.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ QgsSvgCache::QgsSvgCache( QObject *parent )
8484
, mMutex( QMutex::Recursive )
8585
{
8686
mMissingSvg = QStringLiteral( "<svg width='10' height='10'><text x='5' y='10' font-size='10' text-anchor='middle'>?</text></svg>" ).toLatin1();
87-
mFetchingSvg = QStringLiteral( "<svg width='10' height='10'><text x='5' y='10' font-size='10' text-anchor='middle'>x</text></svg>" ).toLatin1();
87+
mFetchingSvg = QStringLiteral( "<svg width='10' height='10'><text x='5' y='10' font-size='10' text-anchor='middle'>&#8987;</text></svg>" ).toLatin1();
8888
}
8989

9090
QgsSvgCache::~QgsSvgCache()

src/gui/symbology/qgssymbolslistwidget.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include "qgssettings.h"
3030
#include "qgsnewauxiliarylayerdialog.h"
3131
#include "qgsauxiliarystorage.h"
32+
#include "qgssvgcache.h"
3233

3334
#include <QAction>
3435
#include <QString>
@@ -114,6 +115,13 @@ QgsSymbolsListWidget::QgsSymbolsListWidget( QgsSymbol *symbol, QgsStyle *style,
114115
connect( btnSaveSymbol, &QPushButton::clicked, this, &QgsSymbolsListWidget::saveSymbol );
115116

116117
connect( mOpacityWidget, &QgsOpacityWidget::opacityChanged, this, &QgsSymbolsListWidget::opacityChanged );
118+
119+
// when a remote svg has been fetched, update the widget's previews
120+
// this is required if the symbol utilises remote svgs, and the current previews
121+
// have been generated using the temporary "downloading" svg. In this case
122+
// we require the preview to be regenerated to use the correct fetched
123+
// svg
124+
connect( QgsApplication::svgCache(), &QgsSvgCache::remoteSvgFetched, this, &QgsSymbolsListWidget::populateSymbolView );
117125
}
118126

119127
QgsSymbolsListWidget::~QgsSymbolsListWidget()

src/gui/symbology/qgssymbolslistwidget.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ class GUI_EXPORT QgsSymbolsListWidget : public QWidget, private Ui::SymbolsListW
104104
void updateAssistantSymbol();
105105
void opacityChanged( double value );
106106
void createAuxiliaryField();
107+
void populateSymbolView();
107108

108109
private:
109110
QgsSymbol *mSymbol = nullptr;
@@ -114,7 +115,6 @@ class GUI_EXPORT QgsSymbolsListWidget : public QWidget, private Ui::SymbolsListW
114115
QgsVectorLayer *mLayer = nullptr;
115116
QgsMapCanvas *mMapCanvas = nullptr;
116117

117-
void populateSymbolView();
118118
void populateSymbols( const QStringList &symbols );
119119
void updateSymbolColor();
120120
void updateSymbolInfo();

0 commit comments

Comments
 (0)