Skip to content

Commit dfcc86e

Browse files
author
mhugent
committedJan 11, 2011
Apply only default size (not all other default settings) when adding scalebar to composer view
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@15016 c8812cc2-4d05-0410-92ff-de0c093fc19c

File tree

4 files changed

+13
-3
lines changed

4 files changed

+13
-3
lines changed
 

‎python/core/qgscomposerscalebar.sip

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,11 @@ class QgsComposerScaleBar: QgsComposerItem
5858

5959
double segmentMillimeters() const;
6060

61-
/**Apply default settings (scale bar 1/5 of map item width)*/
61+
/**Apply default settings*/
6262
void applyDefaultSettings();
63+
/**Apply default size (scale bar 1/5 of map item width)
64+
@note this method was added in version 1.7*/
65+
void applyDefaultSize();
6366

6467
/**Sets style by name
6568
@param styleName (untranslated) style name. Possibilities are: 'Single Box', 'Double Box', 'Line Ticks Middle', 'Line Ticks Down', 'Line Ticks Up', 'Numeric'*/

‎src/core/composer/qgscomposerscalebar.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
QgsComposerScaleBar::QgsComposerScaleBar( QgsComposition* composition ): QgsComposerItem( composition ), mComposerMap( 0 ), mStyle( 0 ), mSegmentMillimeters( 0.0 )
3232
{
3333
applyDefaultSettings();
34+
applyDefaultSize();
3435
}
3536

3637
QgsComposerScaleBar::~QgsComposerScaleBar()
@@ -130,7 +131,10 @@ void QgsComposerScaleBar::applyDefaultSettings()
130131

131132
mLabelBarSpace = 3.0;
132133
mBoxContentSpace = 1.0;
134+
}
133135

136+
void QgsComposerScaleBar::applyDefaultSize()
137+
{
134138
if ( mComposerMap )
135139
{
136140
//calculate mNumUnitsPerSegment

‎src/core/composer/qgscomposerscalebar.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,11 @@ class CORE_EXPORT QgsComposerScaleBar: public QgsComposerItem
8181

8282
double segmentMillimeters() const {return mSegmentMillimeters;}
8383

84-
/**Apply default settings (scale bar 1/5 of map item width)*/
84+
/**Apply default settings*/
8585
void applyDefaultSettings();
86+
/**Apply default size (scale bar 1/5 of map item width)
87+
@note this method was added in version 1.7*/
88+
void applyDefaultSize();
8689

8790
/**Sets style by name
8891
@param styleName (untranslated) style name. Possibilities are: 'Single Box', 'Double Box', 'Line Ticks Middle', 'Line Ticks Down', 'Line Ticks Up', 'Numeric'*/

‎src/gui/qgscomposerview.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,7 @@ void QgsComposerView::addComposerScaleBar( QgsComposerScaleBar* scaleBar )
550550
{
551551
scaleBar->setComposerMap( mapItemList.at( 0 ) );
552552
}
553-
scaleBar->applyDefaultSettings(); //4 segments, 1/5 of composer map width
553+
scaleBar->applyDefaultSize(); //4 segments, 1/5 of composer map width
554554
scene()->addItem( scaleBar );
555555
emit composerScaleBarAdded( scaleBar );
556556
scene()->clearSelection();

0 commit comments

Comments
 (0)
Please sign in to comment.