@@ -281,7 +281,9 @@ bool QgsConditionalStyle::writeXml( QDomNode &node, QDomDocument &doc ) const
281
281
stylesel.setAttribute ( " rule" , mRule );
282
282
stylesel.setAttribute ( " name" , mName );
283
283
stylesel.setAttribute ( " background_color" , mBackColor .name () );
284
+ stylesel.setAttribute ( " background_color_alpha" , mBackColor .alpha () );
284
285
stylesel.setAttribute ( " text_color" , mTextColor .name () );
286
+ stylesel.setAttribute ( " text_color_alpha" , mTextColor .alpha () );
285
287
QDomElement labelFontElem = QgsFontUtils::toXmlElement ( mFont , doc, " font" );
286
288
stylesel.appendChild ( labelFontElem );
287
289
if ( ! mSymbol .isNull () )
@@ -298,8 +300,18 @@ bool QgsConditionalStyle::readXml( const QDomNode &node )
298
300
QDomElement styleElm = node.toElement ();
299
301
setRule ( styleElm.attribute ( " rule" ) );
300
302
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 );
303
315
QgsFontUtils::setFromXmlChildNode ( mFont , styleElm, " font" );
304
316
QDomElement symbolElm = styleElm.firstChildElement ( " symbol" );
305
317
if ( !symbolElm.isNull () )
0 commit comments