Skip to content

Commit

Permalink
[svg markers] allow setting alpha value for fill and outline colors
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn authored and nyalldawson committed Dec 8, 2015
1 parent ee72079 commit 757cd7a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
18 changes: 17 additions & 1 deletion src/core/symbology-ng/qgssvgcache.cpp
Expand Up @@ -620,14 +620,22 @@ void QgsSvgCache::replaceElemParams( QDomElement& elem, const QColor& fill, cons
}
QString key = keyValueSplit.at( 0 );
QString value = keyValueSplit.at( 1 );
if ( value.startsWith( "param(fill" ) )
if ( value.startsWith( "param(fill)" ) )
{
value = fill.name();
}
else if ( value.startsWith( "param(fill-opacity)" ) )
{
value = fill.alphaF();
}
else if ( value.startsWith( "param(outline)" ) )
{
value = outline.name();
}
else if ( value.startsWith( "param(outline-opacity)" ) )
{
value = outline.alphaF();
}
else if ( value.startsWith( "param(outline-width)" ) )
{
value = QString::number( outlineWidth );
Expand All @@ -648,10 +656,18 @@ void QgsSvgCache::replaceElemParams( QDomElement& elem, const QColor& fill, cons
{
elem.setAttribute( attribute.name(), fill.name() );
}
else if ( value.startsWith( "param(fill-opacity)" ) )
{
elem.setAttribute( attribute.name(), fill.alphaF() );
}
else if ( value.startsWith( "param(outline)" ) )
{
elem.setAttribute( attribute.name(), outline.name() );
}
else if ( value.startsWith( "param(outline-opacity)" ) )
{
elem.setAttribute( attribute.name(), outline.alphaF() );
}
else if ( value.startsWith( "param(outline-width)" ) )
{
elem.setAttribute( attribute.name(), QString::number( outlineWidth ) );
Expand Down
5 changes: 3 additions & 2 deletions src/gui/symbology-ng/qgssymbollayerv2widget.cpp
Expand Up @@ -1564,11 +1564,12 @@ QgsSvgMarkerSymbolLayerV2Widget::QgsSvgMarkerSymbolLayerV2Widget( const QgsVecto
mBorderWidthUnitWidget->setUnits( QgsSymbolV2::OutputUnitList() << QgsSymbolV2::MM << QgsSymbolV2::MapUnit << QgsSymbolV2::Pixel );
mOffsetUnitWidget->setUnits( QgsSymbolV2::OutputUnitList() << QgsSymbolV2::MM << QgsSymbolV2::MapUnit << QgsSymbolV2::Pixel );
viewGroups->setHeaderHidden( true );

mChangeColorButton->setAllowAlpha( true );
mChangeColorButton->setColorDialogTitle( tr( "Select fill color" ) );
mChangeColorButton->setContext( "symbology" );
mChangeBorderColorButton->setAllowAlpha( true );
mChangeBorderColorButton->setColorDialogTitle( tr( "Select border color" ) );
mChangeColorButton->setContext( "symbology" );
mChangeBorderColorButton->setContext( "symbology" );

spinOffsetX->setClearValue( 0.0 );
spinOffsetY->setClearValue( 0.0 );
Expand Down

0 comments on commit 757cd7a

Please sign in to comment.