Skip to content

Commit

Permalink
Mapcanvas background colour is now user configureable
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@4671 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
timlinux committed Jan 12, 2006
1 parent 297cbba commit 6d44851
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/gui/qgisapp.cpp
Expand Up @@ -5156,12 +5156,12 @@ void QgisApp::projectProperties()
{
mMapCanvas->recalculateExtents();
}
}
int myRedInt = QgsProject::instance()->readNumEntry("Gui","/CanvasColorRedPart",255);
int myGreenInt = QgsProject::instance()->readNumEntry("Gui","/CanvasColorGreenPart",255);
int myBlueInt = QgsProject::instance()->readNumEntry("Gui","/CanvasColorBluePart",255);
QColor myColor = QColor(myRedInt,myGreenInt,myBlueInt);
mMapCanvas->setCanvasColor(myColor);
}
// Set the window title.
setTitleBarText_( *this );
// delete the property sheet object
Expand Down
21 changes: 14 additions & 7 deletions src/gui/qgsmapcanvas.cpp
Expand Up @@ -563,10 +563,11 @@ void QgsMapCanvas::render(QPaintDevice * theQPaintDevice)
if ( ! theQPaintDevice ) //painting to mapCanvas->pixmap
{
mCanvasProperties->pmCanvas->fill(mCanvasProperties->bgColor);
std::cout << (QString ("R: %i G: %i B: %i for canvas background").arg(
mCanvasProperties->bgColor.red(),
mCanvasProperties->bgColor.red(),
mCanvasProperties->bgColor.red())).toLocal8Bit().data() << std::endl;
QColor myColor = mCanvasProperties->bgColor;
std::cout << "Canvas background R: ";
std::cout << myColor.red() << " G: ";
std::cout << myColor.green() << " B: ";
std::cout << myColor.blue() << std::endl;
paint->begin(mCanvasProperties->pmCanvas);
if (mCanvasProperties->mAntiAliasFlag)
{
Expand Down Expand Up @@ -2745,10 +2746,16 @@ void QgsMapCanvas::setMapTool(int tool)


/** Write property of QColor bgColor. */
void QgsMapCanvas::setCanvasColor(const QColor & _newVal)
void QgsMapCanvas::setCanvasColor(const QColor & theColor)
{
mCanvasProperties->bgColor = _newVal;
setEraseColor(_newVal);
mCanvasProperties->bgColor = theColor;
setEraseColor(theColor);
QColor myColor = mCanvasProperties->bgColor;
std::cout << "Setting Canvas background R: ";
std::cout << myColor.red() << " G: ";
std::cout << myColor.green() << " B: ";
std::cout << myColor.blue() << std::endl;

} // setCanvasColor


Expand Down

0 comments on commit 6d44851

Please sign in to comment.