Skip to content

Commit

Permalink
Small bug fix - placing a scale bar on the map composer sometimes gives
Browse files Browse the repository at this point in the history
a scalebar with 0 segments. This fixes that.


git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@7449 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
g_j_m committed Nov 18, 2007
1 parent b9179b3 commit a094f31
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/app/composer/qgscomposerscalebar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ QgsComposerScalebar::QgsComposerScalebar ( QgsComposition *composition, int id,
mSegmentLength = isize * powerOf10;

// the scale bar will take cca 1/4 of the map width
mNumSegments = (int) (mapwidth / 4 / mSegmentLength);
// But always have at least one segment.
mNumSegments = std::max(1, (int) (mapwidth / 4 / mSegmentLength));

int segsize = (int) (mSegmentLength * map->scale());

Expand Down

0 comments on commit a094f31

Please sign in to comment.