Skip to content
Permalink
Browse files

[svg markers] allow setting alpha value for fill and outline colors

  • Loading branch information
nirvn authored and nyalldawson committed Dec 8, 2015
1 parent ee72079 commit 757cd7af854ac3fd1a334b57fe9d1c78c24a29e9
Showing with 20 additions and 3 deletions.
  1. +17 −1 src/core/symbology-ng/qgssvgcache.cpp
  2. +3 −2 src/gui/symbology-ng/qgssymbollayerv2widget.cpp
@@ -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 );
@@ -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 ) );
@@ -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 );

0 comments on commit 757cd7a

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