106
106
int myGreenInt = QgsProject::instance ()->readNumEntry (" Digitizing" ," /LineColorGreenPart" ,0 );
107
107
int myBlueInt = QgsProject::instance ()->readNumEntry (" Digitizing" ," /LineColorBluePart" ,0 );
108
108
QColor myColour = QColor (myRedInt,myGreenInt,myBlueInt);
109
- pbnDigitisedLineColour->setPaletteBackgroundColor (myColour);
109
+ // old Qt3 idiom
110
+ // pbnDigitisedLineColour->setPaletteBackgroundColor (myColour);
111
+ // new Qt4 idiom
112
+ QPalette palDigitisedLineColour = pbnDigitisedLineColour->palette ();
113
+ palDigitisedLineColour.setColor ( QPalette::Window, myColour );
114
+ pbnDigitisedLineColour->setPalette (palDigitisedLineColour);
115
+
110
116
111
117
// get the colour selections and set the button colour accordingly
112
118
myRedInt = QgsProject::instance ()->readNumEntry (" Gui" ," /SelectionColorRedPart" ,255 );
113
119
myGreenInt = QgsProject::instance ()->readNumEntry (" Gui" ," /SelectionColorGreenPart" ,255 );
114
120
myBlueInt = QgsProject::instance ()->readNumEntry (" Gui" ," /SelectionColorBluePart" ,0 );
115
121
myColour = QColor (myRedInt,myGreenInt,myBlueInt);
116
- pbnSelectionColour->setPaletteBackgroundColor (myColour);
122
+ // old Qt3 idiom
123
+ // pbnSelectionColour->setPaletteBackgroundColor (myColour);
124
+ // new Qt4 idiom
125
+ QPalette palSelectionColour = pbnSelectionColour->palette ();
126
+ palSelectionColour.setColor ( QPalette::Window, myColour );
127
+ pbnSelectionColour->setPalette (palSelectionColour);
128
+
117
129
// get the colour for map canvas background and set button colour accordingly (default white)
118
130
myRedInt = QgsProject::instance ()->readNumEntry (" Gui" ," /CanvasColorRedPart" ,255 );
119
131
myGreenInt = QgsProject::instance ()->readNumEntry (" Gui" ," /CanvasColorGreenPart" ,255 );
120
132
myBlueInt = QgsProject::instance ()->readNumEntry (" Gui" ," /CanvasColorBluePart" ,255 );
121
133
myColour = QColor (myRedInt,myGreenInt,myBlueInt);
122
- pbnCanvasColor->setPaletteBackgroundColor (myColour);
134
+ // old Qt3 idiom
135
+ // pbnCanvasColor->setPaletteBackgroundColor (myColour);
136
+ // new Qt4 idiom
137
+ QPalette palCanvasColor = pbnCanvasColor->palette ();
138
+ palCanvasColor.setColor ( QPalette::Window, myColour );
139
+ pbnCanvasColor->setPalette (palCanvasColor);
123
140
}
124
141
125
142
QgsProjectProperties::~QgsProjectProperties ()
@@ -264,20 +281,29 @@ void QgsProjectProperties::apply()
264
281
QgsProject::instance ()->writeEntry (" Digitizing" ," /LineWidth" ,spinDigitisedLineWidth->value ());
265
282
266
283
// set the colour of digitising lines
267
- QColor myColour = pbnDigitisedLineColour->paletteBackgroundColor ();
284
+ // old Qt3 idiom
285
+ // QColor myColour = pbnDigitisedLineColour->paletteBackgroundColor();
286
+ // new Qt4 idiom
287
+ QColor myColour = pbnDigitisedLineColour->palette ().color (QPalette::Window);
268
288
QgsProject::instance ()->writeEntry (" Digitizing" ," /LineColorRedPart" ,myColour.red ());
269
289
QgsProject::instance ()->writeEntry (" Digitizing" ," /LineColorGreenPart" ,myColour.green ());
270
290
QgsProject::instance ()->writeEntry (" Digitizing" ," /LineColorBluePart" ,myColour.blue ());
271
291
272
292
// set the colour for selections
273
- myColour = pbnSelectionColour->paletteBackgroundColor ();
293
+ // old Qt3 idiom
294
+ // myColour = pbnSelectionColour->paletteBackgroundColor();
295
+ // new Qt4 idiom
296
+ myColour = pbnSelectionColour->palette ().color (QPalette::Window);
274
297
QgsProject::instance ()->writeEntry (" Gui" ," /SelectionColorRedPart" ,myColour.red ());
275
298
QgsProject::instance ()->writeEntry (" Gui" ," /SelectionColorGreenPart" ,myColour.green ());
276
299
QgsProject::instance ()->writeEntry (" Gui" ," /SelectionColorBluePart" ,myColour.blue ());
277
300
QgsRenderer::mSelectionColor =myColour;
278
301
279
302
// set the colour for canvas
280
- myColour = pbnCanvasColor->paletteBackgroundColor ();
303
+ // old Qt3 idiom
304
+ // myColour = pbnCanvasColor->paletteBackgroundColor();
305
+ // new Qt4 idiom
306
+ myColour = pbnCanvasColor->palette ().color (QPalette::Window);
281
307
QgsProject::instance ()->writeEntry (" Gui" ," /CanvasColorRedPart" ,myColour.red ());
282
308
QgsProject::instance ()->writeEntry (" Gui" ," /CanvasColorGreenPart" ,myColour.green ());
283
309
QgsProject::instance ()->writeEntry (" Gui" ," /CanvasColorBluePart" ,myColour.blue ());
@@ -304,28 +330,52 @@ void QgsProjectProperties::showProjectionsTab()
304
330
305
331
void QgsProjectProperties::on_pbnDigitisedLineColour_clicked ()
306
332
{
307
- QColor color = QColorDialog::getColor (pbnDigitisedLineColour->paletteBackgroundColor (),this );
333
+ // old Qt3 idiom
334
+ // QColor color = QColorDialog::getColor(pbnDigitisedLineColour->paletteBackgroundColor(),this);
335
+ // new Qt4 idiom
336
+ QPalette palDigitisedLineColour = pbnDigitisedLineColour->palette ();
337
+ QColor color = QColorDialog::getColor ( palDigitisedLineColour.color (QPalette::Window), this );
308
338
if (color.isValid ())
309
339
{
310
- pbnDigitisedLineColour->setPaletteBackgroundColor (color);
340
+ // old Qt3 idiom
341
+ // pbnDigitisedLineColour->setPaletteBackgroundColor(color);
342
+ // new Qt4 idiom
343
+ palDigitisedLineColour.setColor ( QPalette::Window, color );
344
+ pbnDigitisedLineColour->setPalette (palDigitisedLineColour);
311
345
}
312
346
}
313
347
314
348
void QgsProjectProperties::on_pbnSelectionColour_clicked ()
315
349
{
316
- QColor color = QColorDialog::getColor (pbnSelectionColour->paletteBackgroundColor (),this );
350
+ // old Qt3 idiom
351
+ // QColor color = QColorDialog::getColor(pbnSelectionColour->paletteBackgroundColor(),this);
352
+ // new Qt4 idiom
353
+ QPalette palSelectionColour = pbnSelectionColour->palette ();
354
+ QColor color = QColorDialog::getColor ( palSelectionColour.color (QPalette::Window), this );
317
355
if (color.isValid ())
318
356
{
319
- pbnSelectionColour->setPaletteBackgroundColor (color);
357
+ // old Qt3 idiom
358
+ // pbnSelectionColour->setPaletteBackgroundColor(color);
359
+ // new Qt4 idiom
360
+ palSelectionColour.setColor ( QPalette::Window, color );
361
+ pbnSelectionColour->setPalette (palSelectionColour);
320
362
}
321
363
}
322
364
323
365
void QgsProjectProperties::on_pbnCanvasColor_clicked ()
324
366
{
325
- QColor color = QColorDialog::getColor (pbnCanvasColor->paletteBackgroundColor (),this );
367
+ // old Qt3 idiom
368
+ // QColor color = QColorDialog::getColor(pbnCanvasColor->paletteBackgroundColor(),this);
369
+ // new Qt4 idiom
370
+ QPalette palCanvasColor = pbnCanvasColor->palette ();
371
+ QColor color = QColorDialog::getColor ( palCanvasColor.color (QPalette::Window), this );
326
372
if (color.isValid ())
327
373
{
328
- pbnCanvasColor->setPaletteBackgroundColor (color);
374
+ // old Qt3 idiom
375
+ // pbnCanvasColor->setPaletteBackgroundColor(color);
376
+ // new Qt4 idiom
377
+ palCanvasColor.setColor ( QPalette::Window, color );
378
+ pbnCanvasColor->setPalette (palCanvasColor);
329
379
}
330
380
}
331
381
void QgsProjectProperties::on_pbnHelp_clicked ()
0 commit comments