Skip to content
Permalink
Browse files

[ui] Fix SVG marker widget not properly restoring colors

  • Loading branch information
github-actions authored and nyalldawson committed Aug 20, 2020
1 parent ff2807e commit b05aa103dc8d9d3aa99f1fca778b1e0ec319325c
@@ -452,7 +452,15 @@ Creates a new QgsSvgMarkerSymbolLayerWidget.
protected:

void populateList();
void setGuiForSvg( const QgsSvgMarkerSymbolLayer *layer );

void setGuiForSvg( const QgsSvgMarkerSymbolLayer *layer, bool skipDefaultColors = false );
%Docstring
Updates the GUI to reflect the SVG marker symbol ``layer``.

:param layer: SVG marker symbol layer
:param skipDefaultColors: if ``True``, the default fill and outline colors of the SVG file will not overwrite
the ones from the symbol layer
%End


};
@@ -2349,7 +2349,7 @@ void QgsSvgMarkerSymbolLayerWidget::populateIcons( const QModelIndex &idx )
connect( viewImages->selectionModel(), &QItemSelectionModel::currentChanged, this, &QgsSvgMarkerSymbolLayerWidget::setName );
}

void QgsSvgMarkerSymbolLayerWidget::setGuiForSvg( const QgsSvgMarkerSymbolLayer *layer )
void QgsSvgMarkerSymbolLayerWidget::setGuiForSvg( const QgsSvgMarkerSymbolLayer *layer, bool skipDefaultColors )
{
if ( !layer )
{
@@ -2376,7 +2376,7 @@ void QgsSvgMarkerSymbolLayerWidget::setGuiForSvg( const QgsSvgMarkerSymbolLayer
{
QColor fill = layer->fillColor();
double existingOpacity = hasFillOpacityParam ? fill.alphaF() : 1.0;
if ( hasDefaultFillColor )
if ( hasDefaultFillColor && !skipDefaultColors )
{
fill = defaultFill;
}
@@ -2387,7 +2387,7 @@ void QgsSvgMarkerSymbolLayerWidget::setGuiForSvg( const QgsSvgMarkerSymbolLayer
{
QColor stroke = layer->strokeColor();
double existingOpacity = hasStrokeOpacityParam ? stroke.alphaF() : 1.0;
if ( hasDefaultStrokeColor )
if ( hasDefaultStrokeColor && !skipDefaultColors )
{
stroke = defaultStroke;
}
@@ -2494,7 +2494,7 @@ void QgsSvgMarkerSymbolLayerWidget::setSymbolLayer( QgsSymbolLayer *layer )
mHorizontalAnchorComboBox->blockSignals( false );
mVerticalAnchorComboBox->blockSignals( false );

setGuiForSvg( mLayer );
setGuiForSvg( mLayer, true );

registerDataDefinedButton( mWidthDDBtn, QgsSymbolLayer::PropertyWidth );
registerDataDefinedButton( mHeightDDBtn, QgsSymbolLayer::PropertyHeight );
@@ -599,8 +599,14 @@ class GUI_EXPORT QgsSvgMarkerSymbolLayerWidget : public QgsSymbolLayerWidget, pr
protected:

void populateList();
//update gui for svg file (insert new path, update activation of gui elements for svg params)
void setGuiForSvg( const QgsSvgMarkerSymbolLayer *layer );

/**
* Updates the GUI to reflect the SVG marker symbol \a layer.
* \param layer SVG marker symbol layer
* \param skipDefaultColors if TRUE, the default fill and outline colors of the SVG file will not overwrite
* the ones from the symbol layer
*/
void setGuiForSvg( const QgsSvgMarkerSymbolLayer *layer, bool skipDefaultColors = false );

QgsSvgMarkerSymbolLayer *mLayer = nullptr;

0 comments on commit b05aa10

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