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

This commit is contained in:
nirvn 2015-12-07 10:50:59 +07:00 committed by Nyall Dawson
parent ee720796a3
commit 757cd7af85
2 changed files with 20 additions and 3 deletions

View File

@ -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 ) );

View File

@ -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 );