Skip to content

Commit 5f1c0cb

Browse files
author
timlinux
committedJan 17, 2008
Limit scale bar with
git-svn-id: http://svn.osgeo.org/qgis/trunk@7992 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 7c346d9 commit 5f1c0cb

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed
 

‎src/gui/qgsquickprint.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,7 @@ void QgsQuickPrint::printMap()
615615
//
616616
// Draw the scale bar
617617
//
618-
renderPrintScaleBar(&myPrintPainter, mpMapCanvas);
618+
renderPrintScaleBar(&myPrintPainter, mpMapCanvas, myLogoXDim);
619619

620620
//
621621
// Finish up
@@ -743,7 +743,9 @@ void QgsQuickPrint::scalePointSymbols( int theScaleFactor, SymbolScalingType the
743743

744744

745745

746-
void QgsQuickPrint::renderPrintScaleBar(QPainter * thepPainter, QgsMapCanvas * thepMapCanvas)
746+
void QgsQuickPrint::renderPrintScaleBar(QPainter * thepPainter,
747+
QgsMapCanvas * thepMapCanvas,
748+
int theMaximumWidth)
747749
{
748750
//hard coding some options for now
749751
int myStyleIndex = 1; //tick up
@@ -757,7 +759,7 @@ void QgsQuickPrint::renderPrintScaleBar(QPainter * thepPainter, QgsMapCanvas * t
757759
int myXMargin=260;
758760
int myYMargin=180;
759761
int myCanvasWidth = thepMapCanvas->width();
760-
int myPreferredSize = myCanvasWidth;
762+
int myPreferredSize = theMaximumWidth;
761763
double myActualSize=myPreferredSize;
762764
int myBufferSize=1; //softcode this later
763765
QColor myBackColor = Qt::white; //used for text

‎src/gui/qgsquickprint.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ public slots:
5353
void setOutputPdf(QString theFileName);
5454
void setMapCanvas(QgsMapCanvas * thepMapCanvas);
5555
private:
56-
void renderPrintScaleBar(QPainter * thepPainter, QgsMapCanvas * thepMapCanvas);
56+
void renderPrintScaleBar(QPainter * thepPainter,
57+
QgsMapCanvas * thepMapCanvas,
58+
int theMaximumWidth);
5759
/**
5860
* Scale symbols in all layers by the specified amount.
5961
* Typically used for printing. Each symbol in

0 commit comments

Comments
 (0)
Please sign in to comment.