@@ -281,7 +281,9 @@ bool QgsConditionalStyle::writeXml( QDomNode &node, QDomDocument &doc ) const
281281 stylesel.setAttribute ( " rule" , mRule );
282282 stylesel.setAttribute ( " name" , mName );
283283 stylesel.setAttribute ( " background_color" , mBackColor .name () );
284+ stylesel.setAttribute ( " background_color_alpha" , mBackColor .alpha () );
284285 stylesel.setAttribute ( " text_color" , mTextColor .name () );
286+ stylesel.setAttribute ( " text_color_alpha" , mTextColor .alpha () );
285287 QDomElement labelFontElem = QgsFontUtils::toXmlElement ( mFont , doc, " font" );
286288 stylesel.appendChild ( labelFontElem );
287289 if ( ! mSymbol .isNull () )
@@ -298,8 +300,18 @@ bool QgsConditionalStyle::readXml( const QDomNode &node )
298300 QDomElement styleElm = node.toElement ();
299301 setRule ( styleElm.attribute ( " rule" ) );
300302 setName ( styleElm.attribute ( " name" ) );
301- setBackgroundColor ( QColor ( styleElm.attribute ( " background_color" ) ) );
302- setTextColor ( QColor ( styleElm.attribute ( " text_color" ) ) );
303+ QColor bColor = QColor ( styleElm.attribute ( " background_color" ) );
304+ if ( styleElm.hasAttribute ( " background_color_alpha" ) )
305+ {
306+ bColor.setAlpha ( styleElm.attribute ( " background_color_alpha" ).toInt () );
307+ }
308+ setBackgroundColor ( bColor );
309+ QColor tColor = QColor ( styleElm.attribute ( " text_color" ) );
310+ if ( styleElm.hasAttribute ( " text_color_alpha" ) )
311+ {
312+ tColor.setAlpha ( styleElm.attribute ( " text_color_alpha" ).toInt () );
313+ }
314+ setTextColor ( tColor );
303315 QgsFontUtils::setFromXmlChildNode ( mFont , styleElm, " font" );
304316 QDomElement symbolElm = styleElm.firstChildElement ( " symbol" );
305317 if ( !symbolElm.isNull () )
0 commit comments