@@ -270,8 +270,6 @@ static void setTitleBarText_( QWidget & qgisApp )
270
270
mQgisInterface = new QgisIface (this );
271
271
// set the legend control for the map canvas
272
272
mMapCanvas ->setLegend (mMapLegend );
273
- QSettings mySettings;
274
- mMapCanvas ->enableAntiAliasing (mySettings.value (" /qgis/enable_anti_aliasing" ).toBool ());
275
273
276
274
277
275
//
@@ -1059,7 +1057,17 @@ void QgisApp::createCanvas()
1059
1057
// "theMapCanvas" used to find this canonical instance later
1060
1058
mMapCanvas = new QgsMapCanvas (NULL , " theMapCanvas" );
1061
1059
QWhatsThis::add (mMapCanvas , tr (" Map canvas. This is where raster and vector layers are displayed when added to the map" ));
1062
- mMapCanvas ->setBackgroundColor (Qt::white); // QColor (220, 235, 255));
1060
+ // set the canvas to the default background colour
1061
+ // the default can be set in qgisoptions
1062
+ // use project properties to override the colour on a per project basis
1063
+ QSettings mySettings;
1064
+ int myRed = mySettings.value (" /qgis/default_canvas_color_red" ,255 ).toInt ();
1065
+ int myGreen = mySettings.value (" /qgis/default_canvas_color_green" ,255 ).toInt ();
1066
+ int myBlue = mySettings.value (" /qgis/default_canvas_color_blue" ,255 ).toInt ();
1067
+ mMapCanvas ->setCanvasColor (QColor (myRed,myGreen,myBlue)); // this is the fill co;our when rendering
1068
+ mMapCanvas ->setBackgroundColor (QColor (myRed,myGreen,myBlue)); // this is for the widget itself
1069
+
1070
+ mMapCanvas ->enableAntiAliasing (mySettings.value (" /qgis/enable_anti_aliasing" ,false ).toBool ());
1063
1071
mMapCanvas ->setMinimumWidth (400 );
1064
1072
QVBoxLayout *myCanvasLayout = new QVBoxLayout;
1065
1073
myCanvasLayout->addWidget (mMapCanvas );
@@ -3008,8 +3016,8 @@ void QgisApp::openProject(int pathIndex)
3008
3016
int myGreenInt = QgsProject::instance ()->readNumEntry (" Gui" ," /CanvasColorGreenPart" ,255 );
3009
3017
int myBlueInt = QgsProject::instance ()->readNumEntry (" Gui" ," /CanvasColorBluePart" ,255 );
3010
3018
QColor myColor = QColor (myRedInt,myGreenInt,myBlueInt);
3011
- mMapCanvas ->setCanvasColor (myColor);
3012
-
3019
+ mMapCanvas ->setCanvasColor (myColor); // this is fill colour before rendering starts
3020
+ mMapCanvas -> setBackgroundColor (myColor); // this is for the widget itself
3013
3021
}
3014
3022
// set the projections enabled icon in the status bar
3015
3023
int myProjectionEnabledFlag =
@@ -5161,7 +5169,8 @@ void QgisApp::projectProperties()
5161
5169
int myGreenInt = QgsProject::instance ()->readNumEntry (" Gui" ," /CanvasColorGreenPart" ,255 );
5162
5170
int myBlueInt = QgsProject::instance ()->readNumEntry (" Gui" ," /CanvasColorBluePart" ,255 );
5163
5171
QColor myColor = QColor (myRedInt,myGreenInt,myBlueInt);
5164
- mMapCanvas ->setCanvasColor (myColor);
5172
+ mMapCanvas ->setCanvasColor (myColor); // this is fil colour before rendering onto canvas
5173
+ mMapCanvas ->setBackgroundColor (myColor); // this is for the widget itself
5165
5174
// Set the window title.
5166
5175
setTitleBarText_ ( *this );
5167
5176
// delete the property sheet object
0 commit comments