From 4479cd70b2eead083f1a2e28edb499b82af91a59 Mon Sep 17 00:00:00 2001 From: Marco Hugentobler Date: Tue, 22 Jan 2013 16:13:01 +0100 Subject: [PATCH] [Feature: Add more color options. Provided by olivierdalang]. Modifications for xml reading / writing --- src/core/composer/qgscomposerlegend.cpp | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/src/core/composer/qgscomposerlegend.cpp b/src/core/composer/qgscomposerlegend.cpp index f53ced080789..ea79dcb2cefc 100644 --- a/src/core/composer/qgscomposerlegend.cpp +++ b/src/core/composer/qgscomposerlegend.cpp @@ -728,12 +728,7 @@ bool QgsComposerLegend::writeXML( QDomElement& elem, QDomDocument & doc ) const composerLegendElem.setAttribute( "symbolWidth", QString::number( mSymbolWidth ) ); composerLegendElem.setAttribute( "symbolHeight", QString::number( mSymbolHeight ) ); composerLegendElem.setAttribute( "wrapChar", mWrapChar ); - //font color - QDomElement colorElem = doc.createElement( "fontColor" ); - colorElem.setAttribute( "red", mFontColor.red() ); - colorElem.setAttribute( "green", mFontColor.green() ); - colorElem.setAttribute( "blue", mFontColor.blue() ); - composerLegendElem.appendChild( colorElem ); + composerLegendElem.setAttribute( "fontColor", mFontColor.name() ); if ( mComposerMap ) { @@ -787,15 +782,7 @@ bool QgsComposerLegend::readXML( const QDomElement& itemElem, const QDomDocument } //font color - QDomNodeList fontColorList = itemElem.elementsByTagName( "fontColor" ); - if ( fontColorList.size() > 0 ) - { - QDomElement fontColorElem = fontColorList.at( 0 ).toElement(); - int red = fontColorElem.attribute( "red", "0" ).toInt(); - int green = fontColorElem.attribute( "green", "0" ).toInt(); - int blue = fontColorElem.attribute( "blue", "0" ).toInt(); - mFontColor = QColor( red, green, blue ); - } + mFontColor.setNamedColor( itemElem.attribute( "fontColor", "#000000" ) ); //spaces mBoxSpace = itemElem.attribute( "boxSpace", "2.0" ).toDouble();