@@ -115,27 +115,13 @@ QgsOptions::QgsOptions(QWidget *parent, Qt::WFlags fl) :
115
115
int myRed = settings.value (" /qgis/default_selection_color_red" ,255 ).toInt ();
116
116
int myGreen = settings.value (" /qgis/default_selection_color_green" ,255 ).toInt ();
117
117
int myBlue = settings.value (" /qgis/default_selection_color_blue" ,0 ).toInt ();
118
- // old Qt3 idiom
119
- // pbnSelectionColour->setPaletteBackgroundColor(QColor(myRed,myGreen,myBlue));
120
- // new Qt4 idiom - see http://lists.trolltech.com/qt4-preview-feedback/2005-04/thread00270-0.html for reasoning
121
- #ifdef Q_WS_WIN
122
- // Coloured buttons do not work under the Windows XP style - use plain Windows instead
123
- pbnSelectionColour->setStyle (&mWindowsStyle );
124
- #endif
125
- pbnSelectionColour->setPalette ( QColor (myRed,myGreen,myBlue) );
118
+ pbnSelectionColour->setColor ( QColor (myRed,myGreen,myBlue) );
126
119
127
120
// set the default color for canvas background
128
121
myRed = settings.value (" /qgis/default_canvas_color_red" ,255 ).toInt ();
129
122
myGreen = settings.value (" /qgis/default_canvas_color_green" ,255 ).toInt ();
130
123
myBlue = settings.value (" /qgis/default_canvas_color_blue" ,255 ).toInt ();
131
- // old Qt3 idiom
132
- // pbnCanvasColor->setPaletteBackgroundColor(QColor(myRed,myGreen,myBlue));
133
- // new Qt4 idiom - see http://lists.trolltech.com/qt4-preview-feedback/2005-04/thread00270-0.html for reasoning
134
- #ifdef Q_WS_WIN
135
- // Coloured buttons do not work under the Windows XP style - use plain Windows instead
136
- pbnCanvasColor->setStyle (&mWindowsStyle );
137
- #endif
138
- pbnCanvasColor->setPalette ( QColor (myRed,myGreen,myBlue) );
124
+ pbnCanvasColor->setColor ( QColor (myRed,myGreen,myBlue) );
139
125
140
126
capitaliseCheckBox->setChecked (settings.value (" qgis/capitaliseLayerName" , QVariant (false )).toBool ());
141
127
@@ -150,33 +136,19 @@ QgsOptions::~QgsOptions(){}
150
136
151
137
void QgsOptions::on_pbnSelectionColour_clicked ()
152
138
{
153
- // old Qt3 idiom
154
- // QColor color = QColorDialog::getColor(pbnSelectionColour->paletteBackgroundColor(),this);
155
- // new Qt4 idiom
156
- QPalette palSelectionColour = pbnSelectionColour->palette ();
157
- QColor color = QColorDialog::getColor ( palSelectionColour.color (QPalette::Window), this );
139
+ QColor color = QColorDialog::getColor (pbnSelectionColour->color (), this );
158
140
if (color.isValid ())
159
141
{
160
- // old Qt3 idiom
161
- // pbnSelectionColour->setPaletteBackgroundColor(color);
162
- // new Qt4 idiom - see http://lists.trolltech.com/qt4-preview-feedback/2005-04/thread00270-0.html for reasoning
163
- pbnSelectionColour->setPalette (color);
142
+ pbnSelectionColour->setColor (color);
164
143
}
165
144
}
166
145
167
146
void QgsOptions::on_pbnCanvasColor_clicked ()
168
147
{
169
- // old Qt3 idiom
170
- // QColor color = QColorDialog::getColor(pbnCanvasColor->paletteBackgroundColor(),this);
171
- // new Qt4 idiom
172
- QPalette palCanvasColor = pbnCanvasColor->palette ();
173
- QColor color = QColorDialog::getColor ( palCanvasColor.color (QPalette::Window), this );
148
+ QColor color = QColorDialog::getColor (pbnCanvasColor->color (), this );
174
149
if (color.isValid ())
175
150
{
176
- // old Qt3 idiom
177
- // pbnCanvasColor->setPaletteBackgroundColor(color);
178
- // new Qt4 idiom - see http://lists.trolltech.com/qt4-preview-feedback/2005-04/thread00270-0.html for reasoning
179
- pbnCanvasColor->setPalette (color);
151
+ pbnCanvasColor->setColor (color);
180
152
}
181
153
}
182
154
void QgsOptions::themeChanged (const QString &newThemeName)
@@ -231,19 +203,13 @@ void QgsOptions::saveOptions()
231
203
settings.writeEntry (" /qgis/measure/ellipsoid" , getEllipsoidAcronym (cmbEllipsoid->currentText ()));
232
204
233
205
// set the colour for selections
234
- // old Qt3 idiom
235
- // QColor myColor = pbnSelectionColour->paletteBackgroundColor();
236
- // new Qt4 idiom
237
- QColor myColor = pbnSelectionColour->palette ().color (QPalette::Window);
206
+ QColor myColor = pbnSelectionColour->color ();
238
207
int myRed = settings.writeEntry (" /qgis/default_selection_color_red" ,myColor.red ());
239
208
int myGreen = settings.writeEntry (" /qgis/default_selection_color_green" ,myColor.green ());
240
209
int myBlue = settings.writeEntry (" /qgis/default_selection_color_blue" ,myColor.blue ());
241
210
242
211
// set the default color for canvas background
243
- // old Qt3 idiom
244
- // myColor = pbnCanvasColor->paletteBackgroundColor();
245
- // new Qt4 idiom
246
- myColor = pbnCanvasColor->palette ().color (QPalette::Window);
212
+ myColor = pbnCanvasColor->color ();
247
213
myRed = settings.writeEntry (" /qgis/default_canvas_color_red" ,myColor.red ());
248
214
myGreen = settings.writeEntry (" /qgis/default_canvas_color_green" ,myColor.green ());
249
215
myBlue = settings.writeEntry (" /qgis/default_canvas_color_blue" ,myColor.blue ());
0 commit comments