mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-09 00:08:52 -04:00
Apply only default size (not all other default settings) when adding scalebar to composer view
git-svn-id: http://svn.osgeo.org/qgis/trunk@15016 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
parent
5aed037fdc
commit
2065e89bdd
@ -58,8 +58,11 @@ class QgsComposerScaleBar: QgsComposerItem
|
|||||||
|
|
||||||
double segmentMillimeters() const;
|
double segmentMillimeters() const;
|
||||||
|
|
||||||
/**Apply default settings (scale bar 1/5 of map item width)*/
|
/**Apply default settings*/
|
||||||
void applyDefaultSettings();
|
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
|
/**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'*/
|
@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 )
|
QgsComposerScaleBar::QgsComposerScaleBar( QgsComposition* composition ): QgsComposerItem( composition ), mComposerMap( 0 ), mStyle( 0 ), mSegmentMillimeters( 0.0 )
|
||||||
{
|
{
|
||||||
applyDefaultSettings();
|
applyDefaultSettings();
|
||||||
|
applyDefaultSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
QgsComposerScaleBar::~QgsComposerScaleBar()
|
QgsComposerScaleBar::~QgsComposerScaleBar()
|
||||||
@ -130,7 +131,10 @@ void QgsComposerScaleBar::applyDefaultSettings()
|
|||||||
|
|
||||||
mLabelBarSpace = 3.0;
|
mLabelBarSpace = 3.0;
|
||||||
mBoxContentSpace = 1.0;
|
mBoxContentSpace = 1.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void QgsComposerScaleBar::applyDefaultSize()
|
||||||
|
{
|
||||||
if ( mComposerMap )
|
if ( mComposerMap )
|
||||||
{
|
{
|
||||||
//calculate mNumUnitsPerSegment
|
//calculate mNumUnitsPerSegment
|
||||||
|
@ -81,8 +81,11 @@ class CORE_EXPORT QgsComposerScaleBar: public QgsComposerItem
|
|||||||
|
|
||||||
double segmentMillimeters() const {return mSegmentMillimeters;}
|
double segmentMillimeters() const {return mSegmentMillimeters;}
|
||||||
|
|
||||||
/**Apply default settings (scale bar 1/5 of map item width)*/
|
/**Apply default settings*/
|
||||||
void applyDefaultSettings();
|
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
|
/**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'*/
|
@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->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 );
|
scene()->addItem( scaleBar );
|
||||||
emit composerScaleBarAdded( scaleBar );
|
emit composerScaleBarAdded( scaleBar );
|
||||||
scene()->clearSelection();
|
scene()->clearSelection();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user