Skip to content
Permalink
Browse files
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
  • Loading branch information
mhugent committed Jan 11, 2011
1 parent 63c6d27 commit dfcc86eabce2380a84cd9568d026afc209a9cda9
Showing with 13 additions and 3 deletions.
  1. +4 −1 python/core/qgscomposerscalebar.sip
  2. +4 −0 src/core/composer/qgscomposerscalebar.cpp
  3. +4 −1 src/core/composer/qgscomposerscalebar.h
  4. +1 −1 src/gui/qgscomposerview.cpp
@@ -58,8 +58,11 @@ class QgsComposerScaleBar: QgsComposerItem

double segmentMillimeters() const;

/**Apply default settings (scale bar 1/5 of map item width)*/
/**Apply default settings*/
void applyDefaultSettings();
/**Apply default size (scale bar 1/5 of map item width)
@note this method was added in version 1.7*/
void applyDefaultSize();

/**Sets style by name
@param styleName (untranslated) style name. Possibilities are: 'Single Box', 'Double Box', 'Line Ticks Middle', 'Line Ticks Down', 'Line Ticks Up', 'Numeric'*/
@@ -31,6 +31,7 @@
QgsComposerScaleBar::QgsComposerScaleBar( QgsComposition* composition ): QgsComposerItem( composition ), mComposerMap( 0 ), mStyle( 0 ), mSegmentMillimeters( 0.0 )
{
applyDefaultSettings();
applyDefaultSize();
}

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

mLabelBarSpace = 3.0;
mBoxContentSpace = 1.0;
}

void QgsComposerScaleBar::applyDefaultSize()
{
if ( mComposerMap )
{
//calculate mNumUnitsPerSegment
@@ -81,8 +81,11 @@ class CORE_EXPORT QgsComposerScaleBar: public QgsComposerItem

double segmentMillimeters() const {return mSegmentMillimeters;}

/**Apply default settings (scale bar 1/5 of map item width)*/
/**Apply default settings*/
void applyDefaultSettings();
/**Apply default size (scale bar 1/5 of map item width)
@note this method was added in version 1.7*/
void applyDefaultSize();

/**Sets style by name
@param styleName (untranslated) style name. Possibilities are: 'Single Box', 'Double Box', 'Line Ticks Middle', 'Line Ticks Down', 'Line Ticks Up', 'Numeric'*/
@@ -550,7 +550,7 @@ void QgsComposerView::addComposerScaleBar( QgsComposerScaleBar* scaleBar )
{
scaleBar->setComposerMap( mapItemList.at( 0 ) );
}
scaleBar->applyDefaultSettings(); //4 segments, 1/5 of composer map width
scaleBar->applyDefaultSize(); //4 segments, 1/5 of composer map width
scene()->addItem( scaleBar );
emit composerScaleBarAdded( scaleBar );
scene()->clearSelection();

0 comments on commit dfcc86e

Please sign in to comment.