Skip to content

Commit 0ba0f93

Browse files
committed
Merge branch 'server_search'
2 parents 22f5ba2 + 0c8695c commit 0ba0f93

File tree

4 files changed

+295
-91
lines changed

4 files changed

+295
-91
lines changed

src/mapserver/qgsprojectparser.cpp

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include "qgslogger.h"
2323
#include "qgsmapserviceexception.h"
2424
#include "qgsrasterlayer.h"
25+
#include "qgsrenderer.h"
2526
#include "qgsvectorlayer.h"
2627

2728
#include "qgscomposition.h"
@@ -42,6 +43,7 @@ QgsProjectParser::QgsProjectParser( QDomDocument* xmlDoc, const QString& filePat
4243
{
4344
mOutputUnits = QgsMapRenderer::Millimeters;
4445
setLegendParametersFromProject();
46+
setSelectionColor();
4547
}
4648

4749
QgsProjectParser::~QgsProjectParser()
@@ -1409,3 +1411,50 @@ QString QgsProjectParser::convertToAbsolutePath( const QString& file ) const
14091411
return projElems.join( "/" );
14101412
}
14111413

1414+
void QgsProjectParser::setSelectionColor()
1415+
{
1416+
int red = 255;
1417+
int green = 255;
1418+
int blue = 0;
1419+
int alpha = 255;
1420+
1421+
//overwrite default selection color with settings from the project
1422+
if ( mXMLDoc )
1423+
{
1424+
QDomElement qgisElem = mXMLDoc->documentElement();
1425+
if ( !qgisElem.isNull() )
1426+
{
1427+
QDomElement propertiesElem = qgisElem.firstChildElement( "properties" );
1428+
if ( !propertiesElem.isNull() )
1429+
{
1430+
QDomElement guiElem = propertiesElem.firstChildElement( "Gui" );
1431+
if ( !guiElem.isNull() )
1432+
{
1433+
QDomElement redElem = guiElem.firstChildElement( "SelectionColorRedPart" );
1434+
if ( !redElem.isNull() )
1435+
{
1436+
red = redElem.text().toInt();
1437+
}
1438+
QDomElement greenElem = guiElem.firstChildElement( "SelectionColorGreenPart" );
1439+
if ( !greenElem.isNull() )
1440+
{
1441+
green = greenElem.text().toInt();
1442+
}
1443+
QDomElement blueElem = guiElem.firstChildElement( "SelectionColorBluePart" );
1444+
if ( !blueElem.isNull() )
1445+
{
1446+
blue = blueElem.text().toInt();
1447+
}
1448+
QDomElement alphaElem = guiElem.firstChildElement( "SelectionColorAlphaPart" );
1449+
if ( !alphaElem.isNull() )
1450+
{
1451+
alpha = alphaElem.text().toInt();
1452+
}
1453+
}
1454+
}
1455+
}
1456+
}
1457+
1458+
QgsRenderer::setSelectionColor( QColor( red, green, blue, alpha ) );
1459+
}
1460+

src/mapserver/qgsprojectparser.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,9 @@ class QgsProjectParser: public QgsConfigParser
145145

146146
/**Converts a (possibly relative) path to absolute*/
147147
QString convertToAbsolutePath( const QString& file ) const;
148+
149+
/**Sets global selection color from the project or yellow if not defined in project*/
150+
void setSelectionColor();
148151
};
149152

150153
#endif // QGSPROJECTPARSER_H

0 commit comments

Comments
 (0)