Skip to content
Permalink
Browse files

Update symbol selector when svg cache fetches remote images

  • Loading branch information
nyalldawson committed Apr 9, 2018
1 parent 969b129 commit 2e6a69bdfd1cc9531d335483b87b0bc62ce75ae3
@@ -84,7 +84,7 @@ QgsSvgCache::QgsSvgCache( QObject *parent )
, mMutex( QMutex::Recursive )
{
mMissingSvg = QStringLiteral( "<svg width='10' height='10'><text x='5' y='10' font-size='10' text-anchor='middle'>?</text></svg>" ).toLatin1();
mFetchingSvg = QStringLiteral( "<svg width='10' height='10'><text x='5' y='10' font-size='10' text-anchor='middle'>x</text></svg>" ).toLatin1();
mFetchingSvg = QStringLiteral( "<svg width='10' height='10'><text x='5' y='10' font-size='10' text-anchor='middle'>&#8987;</text></svg>" ).toLatin1();
}

QgsSvgCache::~QgsSvgCache()
@@ -29,6 +29,7 @@
#include "qgssettings.h"
#include "qgsnewauxiliarylayerdialog.h"
#include "qgsauxiliarystorage.h"
#include "qgssvgcache.h"

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

connect( mOpacityWidget, &QgsOpacityWidget::opacityChanged, this, &QgsSymbolsListWidget::opacityChanged );

// when a remote svg has been fetched, update the widget's previews
// this is required if the symbol utilises remote svgs, and the current previews
// 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, &QgsSymbolsListWidget::populateSymbolView );
}

QgsSymbolsListWidget::~QgsSymbolsListWidget()
@@ -104,6 +104,7 @@ class GUI_EXPORT QgsSymbolsListWidget : public QWidget, private Ui::SymbolsListW
void updateAssistantSymbol();
void opacityChanged( double value );
void createAuxiliaryField();
void populateSymbolView();

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

void populateSymbolView();
void populateSymbols( const QStringList &symbols );
void updateSymbolColor();
void updateSymbolInfo();

0 comments on commit 2e6a69b

Please sign in to comment.
You can’t perform that action at this time.