@@ -728,12 +728,7 @@ bool QgsComposerLegend::writeXML( QDomElement& elem, QDomDocument & doc ) const
728728 composerLegendElem.setAttribute ( " symbolWidth" , QString::number ( mSymbolWidth ) );
729729 composerLegendElem.setAttribute ( " symbolHeight" , QString::number ( mSymbolHeight ) );
730730 composerLegendElem.setAttribute ( " wrapChar" , mWrapChar );
731- // font color
732- QDomElement colorElem = doc.createElement ( " fontColor" );
733- colorElem.setAttribute ( " red" , mFontColor .red () );
734- colorElem.setAttribute ( " green" , mFontColor .green () );
735- colorElem.setAttribute ( " blue" , mFontColor .blue () );
736- composerLegendElem.appendChild ( colorElem );
731+ composerLegendElem.setAttribute ( " fontColor" , mFontColor .name () );
737732
738733 if ( mComposerMap )
739734 {
@@ -787,15 +782,7 @@ bool QgsComposerLegend::readXML( const QDomElement& itemElem, const QDomDocument
787782 }
788783
789784 // font color
790- QDomNodeList fontColorList = itemElem.elementsByTagName ( " fontColor" );
791- if ( fontColorList.size () > 0 )
792- {
793- QDomElement fontColorElem = fontColorList.at ( 0 ).toElement ();
794- int red = fontColorElem.attribute ( " red" , " 0" ).toInt ();
795- int green = fontColorElem.attribute ( " green" , " 0" ).toInt ();
796- int blue = fontColorElem.attribute ( " blue" , " 0" ).toInt ();
797- mFontColor = QColor ( red, green, blue );
798- }
785+ mFontColor .setNamedColor ( itemElem.attribute ( " fontColor" , " #000000" ) );
799786
800787 // spaces
801788 mBoxSpace = itemElem.attribute ( " boxSpace" , " 2.0" ).toDouble ();
0 commit comments