@@ -273,7 +273,9 @@ bool QgsConditionalStyle::writeXml( QDomNode &node, QDomDocument &doc, const Qgs
273
273
stylesel.setAttribute ( QStringLiteral ( " rule" ), mRule );
274
274
stylesel.setAttribute ( QStringLiteral ( " name" ), mName );
275
275
stylesel.setAttribute ( QStringLiteral ( " background_color" ), mBackColor .name () );
276
+ stylesel.setAttribute ( QStringLiteral ( " background_color_alpha" ), mBackColor .alpha () );
276
277
stylesel.setAttribute ( QStringLiteral ( " text_color" ), mTextColor .name () );
278
+ stylesel.setAttribute ( QStringLiteral ( " text_color_alpha" ), mTextColor .alpha () );
277
279
QDomElement labelFontElem = QgsFontUtils::toXmlElement ( mFont , doc, QStringLiteral ( " font" ) );
278
280
stylesel.appendChild ( labelFontElem );
279
281
if ( mSymbol )
@@ -290,8 +292,18 @@ bool QgsConditionalStyle::readXml( const QDomNode &node, const QgsReadWriteConte
290
292
QDomElement styleElm = node.toElement ();
291
293
setRule ( styleElm.attribute ( QStringLiteral ( " rule" ) ) );
292
294
setName ( styleElm.attribute ( QStringLiteral ( " name" ) ) );
293
- setBackgroundColor ( QColor ( styleElm.attribute ( QStringLiteral ( " background_color" ) ) ) );
294
- setTextColor ( QColor ( styleElm.attribute ( QStringLiteral ( " text_color" ) ) ) );
295
+ QColor bColor = QColor ( styleElm.attribute ( QStringLiteral ( " background_color" ) ) );
296
+ if ( styleElm.hasAttribute ( QStringLiteral ( " background_color_alpha" ) ) )
297
+ {
298
+ bColor.setAlpha ( styleElm.attribute ( QStringLiteral ( " background_color_alpha" ) ).toInt () );
299
+ }
300
+ setBackgroundColor ( bColor );
301
+ QColor tColor = QColor ( styleElm.attribute ( QStringLiteral ( " text_color" ) ) );
302
+ if ( styleElm.hasAttribute ( QStringLiteral ( " text_color_alpha" ) ) )
303
+ {
304
+ tColor.setAlpha ( styleElm.attribute ( QStringLiteral ( " text_color_alpha" ) ).toInt () );
305
+ }
306
+ setTextColor ( tColor );
295
307
QgsFontUtils::setFromXmlChildNode ( mFont , styleElm, QStringLiteral ( " font" ) );
296
308
QDomElement symbolElm = styleElm.firstChildElement ( QStringLiteral ( " symbol" ) );
297
309
if ( !symbolElm.isNull () )
0 commit comments