[QGIS Commit] r8131 - trunk/qgis/src/gui

svn_qgis at osgeo.org svn_qgis at osgeo.org
Sat Feb 9 11:20:53 EST 2008


Author: timlinux
Date: 2008-02-09 11:20:53 -0500 (Sat, 09 Feb 2008)
New Revision: 8131

Modified:
   trunk/qgis/src/gui/qgsquickprint.cpp
Log:
Beatify scale bar a little


Modified: trunk/qgis/src/gui/qgsquickprint.cpp
===================================================================
--- trunk/qgis/src/gui/qgsquickprint.cpp	2008-02-09 16:20:27 UTC (rev 8130)
+++ trunk/qgis/src/gui/qgsquickprint.cpp	2008-02-09 16:20:53 UTC (rev 8131)
@@ -46,6 +46,7 @@
 #include <QString>
 #include <QSettings>
 #include <QSvgRenderer>
+#include <QLinearGradient>
 
 //other includes
 #include <cmath>
@@ -898,14 +899,35 @@
   int myScaleBarWidthInt = (int) myScaleBarWidth;
 
   //now draw the bar itself in user selected color
-  //thepPainter->setPen( myBackgroundPen );
   thepPainter->setPen( myForegroundPen );
+  //make a glossygradient for the background
+  QGradientStops myStops;
+  myStops << QGradientStop(0.0,QColor("#616161"));
+  myStops << QGradientStop(0.5,QColor("#505050"));
+  myStops << QGradientStop(0.6,QColor("#434343"));
+  myStops << QGradientStop(1.0,QColor("#656565"));
+  /** Delete this I think
+  QLinearGradient myGlossyBrush(QPointF(myOriginX,myOriginY), 
+                  QPointF(myOriginX,myOriginY + myMajorTickSize*3));
+  thepPainter->setBrush(myGlossyBrush);
   thepPainter->drawRect( 
       myOriginX, 
       myOriginY, 
       myOriginX + myScaleBarWidthInt,  
       myOriginY + myMajorTickSize
       );
+  */
+  //draw again with the brush in the revers direction to complete teh glossiness
+  QLinearGradient myReverseGlossyBrush(
+                  QPointF(myOriginX,myOriginY +  myMajorTickSize*3), 
+                  QPointF(myOriginX,myOriginY));
+  thepPainter->setBrush(myReverseGlossyBrush);
+  thepPainter->drawRect( 
+      myOriginX, 
+      myOriginY, 
+      myOriginX + myScaleBarWidthInt,  
+      myOriginY + myMajorTickSize
+      );
 
   //
   //Do drawing of scale bar text
@@ -1097,3 +1119,6 @@
   return QPrinter::A4;
 
 }
+
+
+



More information about the QGIS-commit mailing list