Skip to content

Commit a784d6b

Browse files
committedOct 11, 2015
If svg files with params do not have a default value set, then don't
reset the fill/border color and border width when changing svg marker/svg fill SVG files This change makes the behaviour consistent between the svg marker symbol and the other marker symbols. Additionally, svg files which have customisable colors and NO default values set will be shaded in gray fill/black outline in the svg selector widget, to follow the same behaviour as the other marker symbol selectors. Note that this change has NO EFFECT unless the svg files are modified to remove the default param value, so there will be no change for users' custom symbols. A follow up commit will need to remove the default param values from the preinstalled SVG files though. If you want to test in the meantime, I've modified just the first two symbols in the accomodation group to make this change for testing. (refs #10908)
1 parent 1bd2a69 commit a784d6b

File tree

9 files changed

+152
-47
lines changed

9 files changed

+152
-47
lines changed
 

‎images/svg/accommodation/accommodation_alpinehut.svg

Lines changed: 4 additions & 4 deletions
Loading

‎images/svg/accommodation/accommodation_bed_and_breakfast.svg

Lines changed: 7 additions & 7 deletions
Loading

‎python/core/symbology-ng/qgssvgcache.sip

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,25 @@ class QgsSvgCache : QObject
8888
void containsParams( const QString& path, bool& hasFillParam, QColor& defaultFillColor, bool& hasOutlineParam, QColor& defaultOutlineColor, bool& hasOutlineWidthParam,
8989
double& defaultOutlineWidth ) const;
9090

91+
/** Tests if an svg file contains parameters for fill, outline color, outline width. If yes, possible default values are returned. If there are several
92+
* default values in the svg file, only the first one is considered.
93+
* @param path path to SVG file
94+
* @param hasFillParam will be true if fill param present in SVG
95+
* @param hasDefaultFillParam will be true if fill param has a default value specified
96+
* @param defaultFillColor will be set to default fill color specified in SVG, if present
97+
* @param hasOutlineParam will be true if outline param present in SVG
98+
* @param hasDefaultOutlineColor will be true if outline param has a default value specified
99+
* @param defaultOutlineColor will be set to default outline color specified in SVG, if present
100+
* @param hasOutlineWidthParam will be true if outline width param present in SVG
101+
* @param hasDefaultOutlineWidth will be true if outline width param has a default value specified
102+
* @param defaultOutlineWidth will be set to default outline width specified in SVG, if present
103+
* @note available in python bindings as containsParamsV2
104+
* @note added in QGIS 2.12
105+
*/
106+
void containsParams( const QString& path, bool& hasFillParam, bool& hasDefaultFillParam, QColor& defaultFillColor,
107+
bool& hasOutlineParam, bool& hasDefaultOutlineColor, QColor& defaultOutlineColor,
108+
bool& hasOutlineWidthParam, bool& hasDefaultOutlineWidth, double& defaultOutlineWidth ) const /PyName=containsParamsV2/;
109+
91110
/** Get image data*/
92111
QByteArray getImageData( const QString &path ) const;
93112

‎src/core/symbology-ng/qgsfillsymbollayerv2.cpp

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1712,6 +1712,9 @@ QgsSVGFillSymbolLayer::QgsSVGFillSymbolLayer( const QString& svgFilePath, double
17121712
setSvgFilePath( svgFilePath );
17131713
mOutlineWidth = 0.3;
17141714
mAngle = angle;
1715+
mSvgFillColor = QColor( 0, 0, 0 );
1716+
mSvgOutlineColor = QColor( 0, 0, 0 );
1717+
mSvgOutlineWidth = 0.3;
17151718
setDefaultSvgParams();
17161719
mSvgPattern = 0;
17171720
}
@@ -1725,6 +1728,9 @@ QgsSVGFillSymbolLayer::QgsSVGFillSymbolLayer( const QByteArray& svgData, double
17251728
storeViewBox();
17261729
mOutlineWidth = 0.3;
17271730
mAngle = angle;
1731+
mSvgFillColor = QColor( 0, 0, 0 );
1732+
mSvgOutlineColor = QColor( 0, 0, 0 );
1733+
mSvgOutlineWidth = 0.3;
17281734
setSubSymbol( new QgsLineSymbolV2() );
17291735
setDefaultSvgParams();
17301736
mSvgPattern = 0;
@@ -2224,31 +2230,28 @@ void QgsSVGFillSymbolLayer::storeViewBox()
22242230

22252231
void QgsSVGFillSymbolLayer::setDefaultSvgParams()
22262232
{
2227-
//default values
2228-
mSvgFillColor = QColor( 0, 0, 0 );
2229-
mSvgOutlineColor = QColor( 0, 0, 0 );
2230-
mSvgOutlineWidth = 0.3;
2231-
22322233
if ( mSvgFilePath.isEmpty() )
22332234
{
22342235
return;
22352236
}
22362237

22372238
bool hasFillParam, hasOutlineParam, hasOutlineWidthParam;
2239+
bool hasDefaultFillColor, hasDefaultOutlineColor, hasDefaultOutlineWidth;
22382240
QColor defaultFillColor, defaultOutlineColor;
22392241
double defaultOutlineWidth;
2240-
QgsSvgCache::instance()->containsParams( mSvgFilePath, hasFillParam, defaultFillColor, hasOutlineParam, defaultOutlineColor, hasOutlineWidthParam,
2241-
defaultOutlineWidth );
2242+
QgsSvgCache::instance()->containsParams( mSvgFilePath, hasFillParam, hasDefaultFillColor, defaultFillColor,
2243+
hasOutlineParam, hasDefaultOutlineColor, defaultOutlineColor,
2244+
hasOutlineWidthParam, hasDefaultOutlineWidth, defaultOutlineWidth );
22422245

2243-
if ( hasFillParam )
2246+
if ( hasDefaultFillColor )
22442247
{
22452248
mSvgFillColor = defaultFillColor;
22462249
}
2247-
if ( hasOutlineParam )
2250+
if ( hasDefaultOutlineColor )
22482251
{
22492252
mSvgOutlineColor = defaultOutlineColor;
22502253
}
2251-
if ( hasOutlineWidthParam )
2254+
if ( hasDefaultOutlineWidth )
22522255
{
22532256
mSvgOutlineWidth = defaultOutlineWidth;
22542257
}

‎src/core/symbology-ng/qgsmarkersymbollayerv2.cpp

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1070,17 +1070,20 @@ QgsSymbolLayerV2* QgsSvgMarkerSymbolLayerV2::create( const QgsStringMap& props )
10701070
{
10711071
QColor fillColor, outlineColor;
10721072
double outlineWidth;
1073-
bool hasFillParam, hasOutlineParam, hasOutlineWidthParam;
1074-
QgsSvgCache::instance()->containsParams( name, hasFillParam, fillColor, hasOutlineParam, outlineColor, hasOutlineWidthParam, outlineWidth );
1075-
if ( hasFillParam )
1073+
bool hasFillParam = false, hasOutlineParam = false, hasOutlineWidthParam = false;
1074+
bool hasDefaultFillColor = false, hasDefaultOutlineColor = false, hasDefaultOutlineWidth = false;
1075+
QgsSvgCache::instance()->containsParams( name, hasFillParam, hasDefaultFillColor, fillColor,
1076+
hasOutlineParam, hasDefaultOutlineColor, outlineColor,
1077+
hasOutlineWidthParam, hasDefaultOutlineWidth, outlineWidth );
1078+
if ( hasDefaultFillColor )
10761079
{
10771080
m->setFillColor( fillColor );
10781081
}
1079-
if ( hasOutlineParam )
1082+
if ( hasDefaultOutlineColor )
10801083
{
10811084
m->setOutlineColor( outlineColor );
10821085
}
1083-
if ( hasOutlineWidthParam )
1086+
if ( hasDefaultOutlineWidth )
10841087
{
10851088
m->setOutlineWidth( outlineWidth );
10861089
}
@@ -1163,17 +1166,20 @@ void QgsSvgMarkerSymbolLayerV2::setPath( const QString& path )
11631166
mPath = path;
11641167
QColor fillColor, outlineColor;
11651168
double outlineWidth;
1166-
bool hasFillParam, hasOutlineParam, hasOutlineWidthParam;
1167-
QgsSvgCache::instance()->containsParams( path, hasFillParam, fillColor, hasOutlineParam, outlineColor, hasOutlineWidthParam, outlineWidth );
1168-
if ( hasFillParam )
1169+
bool hasFillParam = false, hasOutlineParam = false, hasOutlineWidthParam = false;
1170+
bool hasDefaultFillColor = false, hasDefaultOutlineColor = false, hasDefaultOutlineWidth = false;
1171+
QgsSvgCache::instance()->containsParams( path, hasFillParam, hasDefaultFillColor, fillColor,
1172+
hasOutlineParam, hasDefaultOutlineColor, outlineColor,
1173+
hasOutlineWidthParam, hasDefaultOutlineWidth, outlineWidth );
1174+
if ( hasDefaultFillColor )
11691175
{
11701176
setFillColor( fillColor );
11711177
}
1172-
if ( hasOutlineParam )
1178+
if ( hasDefaultOutlineColor )
11731179
{
11741180
setOutlineColor( outlineColor );
11751181
}
1176-
if ( hasOutlineWidthParam )
1182+
if ( hasDefaultOutlineWidth )
11771183
{
11781184
setOutlineWidth( outlineWidth );
11791185
}

‎src/core/symbology-ng/qgssvgcache.cpp

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -226,22 +226,42 @@ QgsSvgCacheEntry* QgsSvgCache::insertSVG( const QString& file, double size, cons
226226

227227
void QgsSvgCache::containsParams( const QString& path, bool& hasFillParam, QColor& defaultFillColor, bool& hasOutlineParam, QColor& defaultOutlineColor,
228228
bool& hasOutlineWidthParam, double& defaultOutlineWidth ) const
229+
{
230+
bool hasDefaultFillColor = false;
231+
bool hasDefaultOutlineColor = false;
232+
bool hasDefaultOutlineWidth = false;
233+
234+
containsParams( path, hasFillParam, hasDefaultFillColor, defaultFillColor,
235+
hasOutlineParam, hasDefaultOutlineColor, defaultOutlineColor,
236+
hasOutlineWidthParam, hasDefaultOutlineWidth, defaultOutlineWidth );
237+
}
238+
239+
void QgsSvgCache::containsParams( const QString& path,
240+
bool& hasFillParam, bool& hasDefaultFillParam, QColor& defaultFillColor,
241+
bool& hasOutlineParam, bool& hasDefaultOutlineColor, QColor& defaultOutlineColor,
242+
bool& hasOutlineWidthParam, bool& hasDefaultOutlineWidth, double& defaultOutlineWidth ) const
229243
{
230244
hasFillParam = false;
231245
hasOutlineParam = false;
232246
hasOutlineWidthParam = false;
233-
defaultFillColor = QColor( Qt::black );
247+
defaultFillColor = QColor( Qt::white );
234248
defaultOutlineColor = QColor( Qt::black );
235249
defaultOutlineWidth = 0.2;
236250

251+
hasDefaultFillParam = false;
252+
hasDefaultOutlineColor = false;
253+
hasDefaultOutlineWidth = false;
254+
237255
QDomDocument svgDoc;
238256
if ( !svgDoc.setContent( getImageData( path ) ) )
239257
{
240258
return;
241259
}
242260

243261
QDomElement docElem = svgDoc.documentElement();
244-
containsElemParams( docElem, hasFillParam, defaultFillColor, hasOutlineParam, defaultOutlineColor, hasOutlineWidthParam, defaultOutlineWidth );
262+
containsElemParams( docElem, hasFillParam, hasDefaultFillParam, defaultFillColor,
263+
hasOutlineParam, hasDefaultOutlineColor, defaultOutlineColor,
264+
hasOutlineWidthParam, hasDefaultOutlineWidth, defaultOutlineWidth );
245265
}
246266

247267
void QgsSvgCache::replaceParamsAndCacheSvg( QgsSvgCacheEntry* entry )
@@ -632,8 +652,8 @@ void QgsSvgCache::replaceElemParams( QDomElement& elem, const QColor& fill, cons
632652
}
633653
}
634654

635-
void QgsSvgCache::containsElemParams( const QDomElement& elem, bool& hasFillParam, QColor& defaultFill, bool& hasOutlineParam, QColor& defaultOutline,
636-
bool& hasOutlineWidthParam, double& defaultOutlineWidth ) const
655+
void QgsSvgCache::containsElemParams( const QDomElement& elem, bool& hasFillParam, bool& hasDefaultFill, QColor& defaultFill, bool& hasOutlineParam, bool& hasDefaultOutline, QColor& defaultOutline,
656+
bool& hasOutlineWidthParam, bool& hasDefaultOutlineWidth, double& defaultOutlineWidth ) const
637657
{
638658
if ( elem.isNull() )
639659
{
@@ -675,6 +695,7 @@ void QgsSvgCache::containsElemParams( const QDomElement& elem, bool& hasFillPara
675695
if ( valueSplit.size() > 1 )
676696
{
677697
defaultFill = QColor( valueSplit.at( 1 ) );
698+
hasDefaultFill = true;
678699
}
679700
}
680701
else if ( !hasOutlineParam && value.startsWith( "param(outline)" ) )
@@ -683,6 +704,7 @@ void QgsSvgCache::containsElemParams( const QDomElement& elem, bool& hasFillPara
683704
if ( valueSplit.size() > 1 )
684705
{
685706
defaultOutline = QColor( valueSplit.at( 1 ) );
707+
hasDefaultOutline = true;
686708
}
687709
}
688710
else if ( !hasOutlineWidthParam && value.startsWith( "param(outline-width)" ) )
@@ -691,6 +713,7 @@ void QgsSvgCache::containsElemParams( const QDomElement& elem, bool& hasFillPara
691713
if ( valueSplit.size() > 1 )
692714
{
693715
defaultOutlineWidth = valueSplit.at( 1 ).toDouble();
716+
hasDefaultOutlineWidth = true;
694717
}
695718
}
696719
}
@@ -705,6 +728,7 @@ void QgsSvgCache::containsElemParams( const QDomElement& elem, bool& hasFillPara
705728
if ( valueSplit.size() > 1 )
706729
{
707730
defaultFill = QColor( valueSplit.at( 1 ) );
731+
hasDefaultFill = true;
708732
}
709733
}
710734
else if ( !hasOutlineParam && value.startsWith( "param(outline)" ) )
@@ -713,6 +737,7 @@ void QgsSvgCache::containsElemParams( const QDomElement& elem, bool& hasFillPara
713737
if ( valueSplit.size() > 1 )
714738
{
715739
defaultOutline = QColor( valueSplit.at( 1 ) );
740+
hasDefaultOutline = true;
716741
}
717742
}
718743
else if ( !hasOutlineWidthParam && value.startsWith( "param(outline-width)" ) )
@@ -721,6 +746,7 @@ void QgsSvgCache::containsElemParams( const QDomElement& elem, bool& hasFillPara
721746
if ( valueSplit.size() > 1 )
722747
{
723748
defaultOutlineWidth = valueSplit.at( 1 ).toDouble();
749+
hasDefaultOutlineWidth = true;
724750
}
725751
}
726752
}
@@ -732,7 +758,9 @@ void QgsSvgCache::containsElemParams( const QDomElement& elem, bool& hasFillPara
732758
for ( int i = 0; i < nChildren; ++i )
733759
{
734760
QDomElement childElem = childList.at( i ).toElement();
735-
containsElemParams( childElem, hasFillParam, defaultFill, hasOutlineParam, defaultOutline, hasOutlineWidthParam, defaultOutlineWidth );
761+
containsElemParams( childElem, hasFillParam, hasDefaultFill, defaultFill,
762+
hasOutlineParam, hasDefaultOutline, defaultOutline,
763+
hasOutlineWidthParam, hasDefaultOutlineWidth, defaultOutlineWidth );
736764
}
737765
}
738766

‎src/core/symbology-ng/qgssvgcache.h

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,25 @@ class CORE_EXPORT QgsSvgCache : public QObject
114114
void containsParams( const QString& path, bool& hasFillParam, QColor& defaultFillColor, bool& hasOutlineParam, QColor& defaultOutlineColor, bool& hasOutlineWidthParam,
115115
double& defaultOutlineWidth ) const;
116116

117+
/** Tests if an svg file contains parameters for fill, outline color, outline width. If yes, possible default values are returned. If there are several
118+
* default values in the svg file, only the first one is considered.
119+
* @param path path to SVG file
120+
* @param hasFillParam will be true if fill param present in SVG
121+
* @param hasDefaultFillParam will be true if fill param has a default value specified
122+
* @param defaultFillColor will be set to default fill color specified in SVG, if present
123+
* @param hasOutlineParam will be true if outline param present in SVG
124+
* @param hasDefaultOutlineColor will be true if outline param has a default value specified
125+
* @param defaultOutlineColor will be set to default outline color specified in SVG, if present
126+
* @param hasOutlineWidthParam will be true if outline width param present in SVG
127+
* @param hasDefaultOutlineWidth will be true if outline width param has a default value specified
128+
* @param defaultOutlineWidth will be set to default outline width specified in SVG, if present
129+
* @note available in python bindings as containsParamsV2
130+
* @note added in QGIS 2.12
131+
*/
132+
void containsParams( const QString& path, bool& hasFillParam, bool& hasDefaultFillParam, QColor& defaultFillColor,
133+
bool& hasOutlineParam, bool& hasDefaultOutlineColor, QColor& defaultOutlineColor,
134+
bool& hasOutlineWidthParam, bool& hasDefaultOutlineWidth, double& defaultOutlineWidth ) const;
135+
117136
/** Get image data*/
118137
QByteArray getImageData( const QString &path ) const;
119138

@@ -175,8 +194,10 @@ class CORE_EXPORT QgsSvgCache : public QObject
175194
/** Replaces parameters in elements of a dom node and calls method for all child nodes*/
176195
void replaceElemParams( QDomElement& elem, const QColor& fill, const QColor& outline, double outlineWidth );
177196

178-
void containsElemParams( const QDomElement& elem, bool& hasFillParam, QColor& defaultFill, bool& hasOutlineParam, QColor& defaultOutline,
179-
bool& hasOutlineWidthParam, double& defaultOutlineWidth ) const;
197+
void containsElemParams( const QDomElement& elem,
198+
bool& hasFillParam, bool& hasDefaultFill, QColor& defaultFill,
199+
bool& hasOutlineParam, bool& hasDefaultOutline, QColor& defaultOutline,
200+
bool& hasOutlineWidthParam, bool& hasDefaultOutlineWidth, double& defaultOutlineWidth ) const;
180201

181202
/** Calculates scaling for rendered image sizes to SVG logical sizes*/
182203
double calcSizeScaleFactor( QgsSvgCacheEntry* entry, const QDomElement& docElem ) const;

‎src/gui/symbology-ng/qgssvgselectorwidget.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,18 @@ QVariant QgsSvgSelectorListModel::data( const QModelIndex & index, int role ) co
6767
QColor fill, outline;
6868
double outlineWidth;
6969
bool fillParam, outlineParam, outlineWidthParam;
70-
QgsSvgCache::instance()->containsParams( entry, fillParam, fill, outlineParam, outline, outlineWidthParam, outlineWidth );
70+
bool hasDefaultFillColor = false, hasDefaultOutlineColor = false, hasDefaultOutlineWidth = false;
71+
QgsSvgCache::instance()->containsParams( entry, fillParam, hasDefaultFillColor, fill,
72+
outlineParam, hasDefaultOutlineColor, outline,
73+
outlineWidthParam, hasDefaultOutlineWidth, outlineWidth );
74+
75+
//if defaults not set in symbol, use these values
76+
if ( !hasDefaultFillColor )
77+
fill = QColor( 200, 200, 200 );
78+
if ( !hasDefaultOutlineColor )
79+
outline = Qt::black;
80+
if ( !hasDefaultOutlineWidth )
81+
outlineWidth = 0.2;
7182

7283
bool fitsInCache; // should always fit in cache at these sizes (i.e. under 559 px ^ 2, or half cache size)
7384
const QImage& img = QgsSvgCache::instance()->svgAsImage( entry, 30.0, fill, outline, outlineWidth, 3.5 /*appr. 88 dpi*/, 1.0, fitsInCache );

‎src/gui/symbology-ng/qgssymbollayerv2widget.cpp

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1603,7 +1603,18 @@ class QgsSvgListModel : public QAbstractListModel
16031603
QColor fill, outline;
16041604
double outlineWidth;
16051605
bool fillParam, outlineParam, outlineWidthParam;
1606-
QgsSvgCache::instance()->containsParams( entry, fillParam, fill, outlineParam, outline, outlineWidthParam, outlineWidth );
1606+
bool hasDefaultFillColor = false, hasDefaultOutlineColor = false, hasDefaultOutlineWidth = false;
1607+
QgsSvgCache::instance()->containsParams( entry, fillParam, hasDefaultFillColor, fill,
1608+
outlineParam, hasDefaultOutlineColor, outline,
1609+
outlineWidthParam, hasDefaultOutlineWidth, outlineWidth );
1610+
1611+
//if defaults not set in symbol, use these values
1612+
if ( !hasDefaultFillColor )
1613+
fill = QColor( 200, 200, 200 );
1614+
if ( !hasDefaultOutlineColor )
1615+
outline = Qt::black;
1616+
if ( !hasDefaultOutlineWidth )
1617+
outlineWidth = 0.6;
16071618

16081619
bool fitsInCache; // should always fit in cache at these sizes (i.e. under 559 px ^ 2, or half cache size)
16091620
const QImage& img = QgsSvgCache::instance()->svgAsImage( entry, 30.0, fill, outline, outlineWidth, 3.5 /*appr. 88 dpi*/, 1.0, fitsInCache );
@@ -1716,7 +1727,10 @@ void QgsSvgMarkerSymbolLayerV2Widget::setGuiForSvg( const QgsSvgMarkerSymbolLaye
17161727
bool hasFillParam, hasOutlineParam, hasOutlineWidthParam;
17171728
QColor defaultFill, defaultOutline;
17181729
double defaultOutlineWidth;
1719-
QgsSvgCache::instance()->containsParams( layer->path(), hasFillParam, defaultFill, hasOutlineParam, defaultOutline, hasOutlineWidthParam, defaultOutlineWidth );
1730+
bool hasDefaultFillColor, hasDefaultOutlineColor, hasDefaultOutlineWidth;
1731+
QgsSvgCache::instance()->containsParams( layer->path(), hasFillParam, hasDefaultFillColor, defaultFill,
1732+
hasOutlineParam, hasDefaultOutlineColor, defaultOutline,
1733+
hasOutlineWidthParam, hasDefaultOutlineWidth, defaultOutlineWidth );
17201734
mChangeColorButton->setEnabled( hasFillParam );
17211735
mChangeBorderColorButton->setEnabled( hasOutlineParam );
17221736
mBorderWidthSpinBox->setEnabled( hasOutlineWidthParam );
@@ -1727,7 +1741,7 @@ void QgsSvgMarkerSymbolLayerV2Widget::setGuiForSvg( const QgsSvgMarkerSymbolLaye
17271741
{
17281742
mChangeColorButton->setColor( layer->fillColor() );
17291743
}
1730-
else
1744+
else if ( hasDefaultFillColor )
17311745
{
17321746
mChangeColorButton->setColor( defaultFill );
17331747
}
@@ -1738,7 +1752,7 @@ void QgsSvgMarkerSymbolLayerV2Widget::setGuiForSvg( const QgsSvgMarkerSymbolLaye
17381752
{
17391753
mChangeBorderColorButton->setColor( layer->outlineColor() );
17401754
}
1741-
else
1755+
else if ( hasDefaultOutlineColor )
17421756
{
17431757
mChangeBorderColorButton->setColor( defaultOutline );
17441758
}
@@ -2195,18 +2209,21 @@ void QgsSVGFillSymbolLayerWidget::updateParamGui( bool resetValues )
21952209
bool hasFillParam, hasOutlineParam, hasOutlineWidthParam;
21962210
QColor defaultFill, defaultOutline;
21972211
double defaultOutlineWidth;
2198-
QgsSvgCache::instance()->containsParams( mSVGLineEdit->text(), hasFillParam, defaultFill, hasOutlineParam, defaultOutline, hasOutlineWidthParam, defaultOutlineWidth );
2199-
if ( hasFillParam && resetValues )
2212+
bool hasDefaultFillColor, hasDefaultOutlineColor, hasDefaultOutlineWidth;
2213+
QgsSvgCache::instance()->containsParams( mSVGLineEdit->text(), hasFillParam, hasDefaultFillColor, defaultFill,
2214+
hasOutlineParam, hasDefaultOutlineColor, defaultOutline,
2215+
hasOutlineWidthParam, hasDefaultOutlineWidth, defaultOutlineWidth );
2216+
if ( hasDefaultFillColor && resetValues )
22002217
{
22012218
mChangeColorButton->setColor( defaultFill );
22022219
}
22032220
mChangeColorButton->setEnabled( hasFillParam );
2204-
if ( hasOutlineParam && resetValues )
2221+
if ( hasDefaultOutlineColor && resetValues )
22052222
{
22062223
mChangeBorderColorButton->setColor( defaultOutline );
22072224
}
22082225
mChangeBorderColorButton->setEnabled( hasOutlineParam );
2209-
if ( hasOutlineWidthParam && resetValues )
2226+
if ( hasDefaultOutlineWidth && resetValues )
22102227
{
22112228
mBorderWidthSpinBox->setValue( defaultOutlineWidth );
22122229
}

0 commit comments

Comments
 (0)
Please sign in to comment.