Skip to content

Commit 1a0a842

Browse files
author
timlinux
committedJan 12, 2006
In progress...
Implemented global selection colour and canvas colour default options in qgsoptions. Still needs to be wired up in qgisapp so that these defaults are used where applicable. git-svn-id: http://svn.osgeo.org/qgis/trunk@4672 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 0b6ee77 commit 1a0a842

File tree

3 files changed

+108
-6
lines changed

3 files changed

+108
-6
lines changed
 

‎src/gui/qgsoptions.cpp

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include "qgssvgcache.h"
2525
#include <QFileDialog>
2626
#include <QSettings>
27+
#include <QColorDialog>
2728
#include <cassert>
2829
#include <iostream>
2930
#include <sqlite3.h>
@@ -96,11 +97,38 @@ QgsOptions::QgsOptions(QWidget *parent, const char *name, bool modal) :
9697
chkAntiAliasing->setChecked(settings.value("/qgis/enable_anti_aliasing").toBool());
9798
chkAddedVisibility->setChecked(!settings.value("/qgis/new_layers_visible").toBool());
9899
cbxHideSplash->setChecked(settings.value("/qgis/hideSplash").toBool());
100+
//set the colour for selections
101+
int myRed = settings.value("/qgis/default_selection_color_red",255).toInt();
102+
int myGreen = settings.value("/qgis/default_selection_color_green",255).toInt();
103+
int myBlue = settings.value("/qgis/default_selection_color_blue",255).toInt();
104+
pbnSelectionColour->setPaletteBackgroundColor(QColor(myRed,myGreen,myBlue));
105+
//set teh default color for canvas background
106+
myRed = settings.value("/qgis/default_canvas_color_red",255).toInt();
107+
myGreen = settings.value("/qgis/default_canvas_color_green",255).toInt();
108+
myBlue = settings.value("/qgis/default_canvas_color_blue",255).toInt();
109+
pbnCanvasColor->setPaletteBackgroundColor(QColor(myRed,myGreen,myBlue));
99110
}
100111

101112
//! Destructor
102113
QgsOptions::~QgsOptions(){}
103114

115+
void QgsOptions::on_pbnSelectionColour_clicked()
116+
{
117+
QColor color = QColorDialog::getColor(pbnSelectionColour->paletteBackgroundColor(),this);
118+
if (color.isValid())
119+
{
120+
pbnSelectionColour->setPaletteBackgroundColor(color);
121+
}
122+
}
123+
124+
void QgsOptions::on_pbnCanvasColor_clicked()
125+
{
126+
QColor color = QColorDialog::getColor(pbnCanvasColor->paletteBackgroundColor(),this);
127+
if (color.isValid())
128+
{
129+
pbnCanvasColor->setPaletteBackgroundColor(color);
130+
}
131+
}
104132
void QgsOptions::themeChanged(const QString &newThemeName)
105133
{
106134
// Slot to change the theme as user scrolls through the choices
@@ -150,6 +178,16 @@ void QgsOptions::saveOptions()
150178
settings.writeEntry("/Projections/defaultProjectionSRSID",(int)mGlobalSRSID);
151179

152180
settings.writeEntry("/qgis/measure/ellipsoid", getEllipsoidAcronym(cmbEllipsoid->currentText()));
181+
//set the colour for selections
182+
QColor myColor = pbnSelectionColour->paletteBackgroundColor();
183+
int myRed = settings.writeEntry("/qgis/default_selection_color_red",myColor.red());
184+
int myGreen = settings.writeEntry("/qgis/default_selection_color_green",myColor.green());
185+
int myBlue = settings.writeEntry("/qgis/default_selection_color_blue",myColor.blue());
186+
//set teh default color for canvas background
187+
myColor = pbnCanvasColor->paletteBackgroundColor();
188+
myRed = settings.writeEntry("/qgis/default_canvas_color_red",myColor.red());
189+
myGreen = settings.writeEntry("/qgis/default_canvas_color_green",myColor.green());
190+
myBlue = settings.writeEntry("/qgis/default_canvas_color_blue",myColor.blue());
153191

154192
//all done
155193
accept();

‎src/gui/qgsoptions.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,15 @@ class QgsOptions :public QDialog, private Ui::QgsOptionsBase
5757
* true.
5858
*/
5959
bool newVisible();
60+
/*!
61+
* Slot to select the default map selection colour
62+
*/
63+
void on_pbnSelectionColour_clicked();
64+
65+
/*!
66+
* Slot to select the default map selection colour
67+
*/
68+
void on_pbnCanvasColor_clicked();
6069
protected:
6170
//! Populates combo box with ellipsoids
6271
void getEllipsoidList();

‎src/ui/qgsoptionsbase.ui

Lines changed: 61 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
<property name="spacing" >
4242
<number>6</number>
4343
</property>
44-
<item row="2" column="0" >
44+
<item row="3" column="0" >
4545
<spacer>
4646
<property name="orientation" >
4747
<enum>Qt::Vertical</enum>
@@ -54,10 +54,10 @@
5454
</property>
5555
</spacer>
5656
</item>
57-
<item row="0" column="0" >
58-
<widget class="QGroupBox" name="groupBox" >
57+
<item row="2" column="0" >
58+
<widget class="QGroupBox" name="groupBox_9" >
5959
<property name="title" >
60-
<string>&amp;Splash screen</string>
60+
<string>Default Map Appearance (Overridden by project properties)</string>
6161
</property>
6262
<layout class="QGridLayout" >
6363
<property name="margin" >
@@ -66,10 +66,43 @@
6666
<property name="spacing" >
6767
<number>6</number>
6868
</property>
69+
<item row="0" column="2" >
70+
<widget class="QLabel" name="label" >
71+
<property name="text" >
72+
<string>Background Color:</string>
73+
</property>
74+
<property name="buddy" >
75+
<cstring>pbnCanvasColor</cstring>
76+
</property>
77+
</widget>
78+
</item>
79+
<item row="0" column="3" >
80+
<widget class="QToolButton" name="pbnCanvasColor" >
81+
<property name="text" >
82+
<string/>
83+
</property>
84+
</widget>
85+
</item>
86+
<item row="0" column="1" >
87+
<widget class="QToolButton" name="pbnSelectionColour" >
88+
<property name="minimumSize" >
89+
<size>
90+
<width>10</width>
91+
<height>22</height>
92+
</size>
93+
</property>
94+
<property name="text" >
95+
<string/>
96+
</property>
97+
</widget>
98+
</item>
6999
<item row="0" column="0" >
70-
<widget class="QCheckBox" name="cbxHideSplash" >
100+
<widget class="QLabel" name="textLabel1_9" >
71101
<property name="text" >
72-
<string>Hide splash screen at startup</string>
102+
<string>Selection Color:</string>
103+
</property>
104+
<property name="buddy" >
105+
<cstring>pbnSelectionColour</cstring>
73106
</property>
74107
</widget>
75108
</item>
@@ -141,6 +174,28 @@
141174
</layout>
142175
</widget>
143176
</item>
177+
<item row="0" column="0" >
178+
<widget class="QGroupBox" name="groupBox" >
179+
<property name="title" >
180+
<string>&amp;Splash screen</string>
181+
</property>
182+
<layout class="QGridLayout" >
183+
<property name="margin" >
184+
<number>9</number>
185+
</property>
186+
<property name="spacing" >
187+
<number>6</number>
188+
</property>
189+
<item row="0" column="0" >
190+
<widget class="QCheckBox" name="cbxHideSplash" >
191+
<property name="text" >
192+
<string>Hide splash screen at startup</string>
193+
</property>
194+
</widget>
195+
</item>
196+
</layout>
197+
</widget>
198+
</item>
144199
</layout>
145200
</widget>
146201
<widget class="QWidget" name="TabPage" >

0 commit comments

Comments
 (0)