Skip to content
Permalink
Browse files

Merge pull request #6788 from signedav/fix_condformat_alpha_BP_218_3

Backport to 2.18 Save and load alpha of conditional style color
  • Loading branch information
m-kuhn committed Apr 12, 2018
2 parents 6c06421 + 8c8cd8d commit 91384a0900a43573dc1109d83400bbc3612fdd42
Showing with 14 additions and 2 deletions.
  1. +14 −2 src/core/qgsconditionalstyle.cpp
@@ -281,7 +281,9 @@ bool QgsConditionalStyle::writeXml( QDomNode &node, QDomDocument &doc ) const
stylesel.setAttribute( "rule", mRule );
stylesel.setAttribute( "name", mName );
stylesel.setAttribute( "background_color", mBackColor.name() );
stylesel.setAttribute( "background_color_alpha", mBackColor.alpha() );
stylesel.setAttribute( "text_color", mTextColor.name() );
stylesel.setAttribute( "text_color_alpha", mTextColor.alpha() );
QDomElement labelFontElem = QgsFontUtils::toXmlElement( mFont, doc, "font" );
stylesel.appendChild( labelFontElem );
if ( ! mSymbol.isNull() )
@@ -298,8 +300,18 @@ bool QgsConditionalStyle::readXml( const QDomNode &node )
QDomElement styleElm = node.toElement();
setRule( styleElm.attribute( "rule" ) );
setName( styleElm.attribute( "name" ) );
setBackgroundColor( QColor( styleElm.attribute( "background_color" ) ) );
setTextColor( QColor( styleElm.attribute( "text_color" ) ) );
QColor bColor = QColor( styleElm.attribute( "background_color" ) );
if ( styleElm.hasAttribute( "background_color_alpha" ) )
{
bColor.setAlpha( styleElm.attribute( "background_color_alpha" ).toInt() );
}
setBackgroundColor( bColor );
QColor tColor = QColor( styleElm.attribute( "text_color" ) );
if ( styleElm.hasAttribute( "text_color_alpha" ) )
{
tColor.setAlpha( styleElm.attribute( "text_color_alpha" ).toInt() );
}
setTextColor( tColor );
QgsFontUtils::setFromXmlChildNode( mFont, styleElm, "font" );
QDomElement symbolElm = styleElm.firstChildElement( "symbol" );
if ( !symbolElm.isNull() )

0 comments on commit 91384a0

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