Skip to content

Commit c0c3013

Browse files
author
g_j_m
committedNov 18, 2007
Small bug fix - placing a scale bar on the map composer sometimes gives
a scalebar with 0 segments. This fixes that. git-svn-id: http://svn.osgeo.org/qgis/trunk@7449 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 2bec93e commit c0c3013

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed
 

‎src/app/composer/qgscomposerscalebar.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ QgsComposerScalebar::QgsComposerScalebar ( QgsComposition *composition, int id,
8080
mSegmentLength = isize * powerOf10;
8181

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

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

0 commit comments

Comments
 (0)