mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
Read selection color for wms server from project file
This commit is contained in:
parent
a7a85aaa64
commit
0c8695ccc3
@ -43,7 +43,7 @@ QgsProjectParser::QgsProjectParser( QDomDocument* xmlDoc, const QString& filePat
|
||||
{
|
||||
mOutputUnits = QgsMapRenderer::Millimeters;
|
||||
setLegendParametersFromProject();
|
||||
QgsRenderer::setSelectionColor( QColor( 255, 255, 0 ) );
|
||||
setSelectionColor();
|
||||
}
|
||||
|
||||
QgsProjectParser::~QgsProjectParser()
|
||||
@ -1411,3 +1411,50 @@ QString QgsProjectParser::convertToAbsolutePath( const QString& file ) const
|
||||
return projElems.join( "/" );
|
||||
}
|
||||
|
||||
void QgsProjectParser::setSelectionColor()
|
||||
{
|
||||
int red = 255;
|
||||
int green = 255;
|
||||
int blue = 0;
|
||||
int alpha = 255;
|
||||
|
||||
//overwrite default selection color with settings from the project
|
||||
if ( mXMLDoc )
|
||||
{
|
||||
QDomElement qgisElem = mXMLDoc->documentElement();
|
||||
if ( !qgisElem.isNull() )
|
||||
{
|
||||
QDomElement propertiesElem = qgisElem.firstChildElement( "properties" );
|
||||
if ( !propertiesElem.isNull() )
|
||||
{
|
||||
QDomElement guiElem = propertiesElem.firstChildElement( "Gui" );
|
||||
if ( !guiElem.isNull() )
|
||||
{
|
||||
QDomElement redElem = guiElem.firstChildElement( "SelectionColorRedPart" );
|
||||
if ( !redElem.isNull() )
|
||||
{
|
||||
red = redElem.text().toInt();
|
||||
}
|
||||
QDomElement greenElem = guiElem.firstChildElement( "SelectionColorGreenPart" );
|
||||
if ( !greenElem.isNull() )
|
||||
{
|
||||
green = greenElem.text().toInt();
|
||||
}
|
||||
QDomElement blueElem = guiElem.firstChildElement( "SelectionColorBluePart" );
|
||||
if ( !blueElem.isNull() )
|
||||
{
|
||||
blue = blueElem.text().toInt();
|
||||
}
|
||||
QDomElement alphaElem = guiElem.firstChildElement( "SelectionColorAlphaPart" );
|
||||
if ( !alphaElem.isNull() )
|
||||
{
|
||||
alpha = alphaElem.text().toInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QgsRenderer::setSelectionColor( QColor( red, green, blue, alpha ) );
|
||||
}
|
||||
|
||||
|
@ -145,6 +145,9 @@ class QgsProjectParser: public QgsConfigParser
|
||||
|
||||
/**Converts a (possibly relative) path to absolute*/
|
||||
QString convertToAbsolutePath( const QString& file ) const;
|
||||
|
||||
/**Sets global selection color from the project or yellow if not defined in project*/
|
||||
void setSelectionColor();
|
||||
};
|
||||
|
||||
#endif // QGSPROJECTPARSER_H
|
||||
|
Loading…
x
Reference in New Issue
Block a user