|
24 | 24 | #include "qgssvgcache.h"
|
25 | 25 | #include <QFileDialog>
|
26 | 26 | #include <QSettings>
|
| 27 | +#include <QColorDialog> |
27 | 28 | #include <cassert>
|
28 | 29 | #include <iostream>
|
29 | 30 | #include <sqlite3.h>
|
@@ -96,11 +97,38 @@ QgsOptions::QgsOptions(QWidget *parent, const char *name, bool modal) :
|
96 | 97 | chkAntiAliasing->setChecked(settings.value("/qgis/enable_anti_aliasing").toBool());
|
97 | 98 | chkAddedVisibility->setChecked(!settings.value("/qgis/new_layers_visible").toBool());
|
98 | 99 | 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)); |
99 | 110 | }
|
100 | 111 |
|
101 | 112 | //! Destructor
|
102 | 113 | QgsOptions::~QgsOptions(){}
|
103 | 114 |
|
| 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 | +} |
104 | 132 | void QgsOptions::themeChanged(const QString &newThemeName)
|
105 | 133 | {
|
106 | 134 | // Slot to change the theme as user scrolls through the choices
|
@@ -150,6 +178,16 @@ void QgsOptions::saveOptions()
|
150 | 178 | settings.writeEntry("/Projections/defaultProjectionSRSID",(int)mGlobalSRSID);
|
151 | 179 |
|
152 | 180 | 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()); |
153 | 191 |
|
154 | 192 | //all done
|
155 | 193 | accept();
|
|
0 commit comments