Skip to content

Commit

Permalink
Update symbol selector when svg cache fetches remote images
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Apr 9, 2018
1 parent 969b129 commit 2e6a69b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/core/symbology/qgssvgcache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
8 changes: 8 additions & 0 deletions src/gui/symbology/qgssymbolslistwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "qgssettings.h"
#include "qgsnewauxiliarylayerdialog.h"
#include "qgsauxiliarystorage.h"
#include "qgssvgcache.h"

#include <QAction>
#include <QString>
Expand Down Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion src/gui/symbology/qgssymbolslistwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();
Expand Down

0 comments on commit 2e6a69b

Please sign in to comment.