Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #5107 from nyalldawson/scalebar_height
[composer] Allow finer setting of scalebar height and widths
  • Loading branch information
nyalldawson committed Sep 2, 2017
2 parents aec8cd3 + f64f8e2 commit 474f39a
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions src/app/composer/qgscomposerscalebarwidget.cpp
Expand Up @@ -219,15 +219,15 @@ void QgsComposerScaleBarWidget::on_mNumberOfSegmentsSpinBox_valueChanged( int i
mComposerScaleBar->endCommand();
}

void QgsComposerScaleBarWidget::on_mHeightSpinBox_valueChanged( int i )
void QgsComposerScaleBarWidget::on_mHeightSpinBox_valueChanged( double d )
{
if ( !mComposerScaleBar )
{
return;
}
mComposerScaleBar->beginCommand( tr( "Scalebar height changed" ), QgsComposerMergeCommand::ScaleBarHeight );
disconnectUpdateSignal();
mComposerScaleBar->setHeight( i );
mComposerScaleBar->setHeight( d );
mComposerScaleBar->update();
connectUpdateSignal();
mComposerScaleBar->endCommand();
Expand Down Expand Up @@ -647,7 +647,7 @@ void QgsComposerScaleBarWidget::composerMapChanged( QgsComposerItem* item )
mComposerScaleBar->endCommand();
}

void QgsComposerScaleBarWidget::on_mMinWidthSpinBox_valueChanged( int )
void QgsComposerScaleBarWidget::on_mMinWidthSpinBox_valueChanged( double )
{
if ( !mComposerScaleBar )
{
Expand All @@ -662,7 +662,7 @@ void QgsComposerScaleBarWidget::on_mMinWidthSpinBox_valueChanged( int )
mComposerScaleBar->endCommand();
}

void QgsComposerScaleBarWidget::on_mMaxWidthSpinBox_valueChanged( int )
void QgsComposerScaleBarWidget::on_mMaxWidthSpinBox_valueChanged( double )
{
if ( !mComposerScaleBar )
{
Expand Down
6 changes: 3 additions & 3 deletions src/app/composer/qgscomposerscalebarwidget.h
Expand Up @@ -35,7 +35,7 @@ class QgsComposerScaleBarWidget: public QgsComposerItemBaseWidget, private Ui::Q

public slots:

void on_mHeightSpinBox_valueChanged( int i );
void on_mHeightSpinBox_valueChanged( double d );
void on_mLineWidthSpinBox_valueChanged( double d );
void on_mSegmentSizeSpinBox_valueChanged( double d );
void on_mSegmentsLeftSpinBox_valueChanged( int i );
Expand All @@ -54,8 +54,8 @@ class QgsComposerScaleBarWidget: public QgsComposerItemBaseWidget, private Ui::Q
void on_mUnitsComboBox_currentIndexChanged( int index );
void on_mLineJoinStyleCombo_currentIndexChanged( int index );
void on_mLineCapStyleCombo_currentIndexChanged( int index );
void on_mMinWidthSpinBox_valueChanged( int i );
void on_mMaxWidthSpinBox_valueChanged( int i );
void on_mMinWidthSpinBox_valueChanged( double d );
void on_mMaxWidthSpinBox_valueChanged( double d );

private slots:
void setGuiElements();
Expand Down
4 changes: 2 additions & 2 deletions src/core/composer/qgscomposerscalebar.cpp
Expand Up @@ -757,8 +757,8 @@ bool QgsComposerScaleBar::readXML( const QDomElement& itemElem, const QDomDocume
mNumSegmentsLeft = itemElem.attribute( "numSegmentsLeft", "0" ).toInt();
mNumUnitsPerSegment = itemElem.attribute( "numUnitsPerSegment", "1.0" ).toDouble();
mSegmentSizeMode = static_cast<SegmentSizeMode>( itemElem.attribute( "segmentSizeMode", "0" ).toInt() );
mMinBarWidth = itemElem.attribute( "minBarWidth", "50" ).toInt();
mMaxBarWidth = itemElem.attribute( "maxBarWidth", "150" ).toInt();
mMinBarWidth = itemElem.attribute( "minBarWidth", "50" ).toDouble();
mMaxBarWidth = itemElem.attribute( "maxBarWidth", "150" ).toDouble();
mSegmentMillimeters = itemElem.attribute( "segmentMillimeters", "0.0" ).toDouble();
mNumMapUnitsPerScaleBarUnit = itemElem.attribute( "numMapUnitsPerScaleBarUnit", "1.0" ).toDouble();
mPen.setWidthF( itemElem.attribute( "outlineWidth", "0.3" ).toDouble() );
Expand Down
6 changes: 3 additions & 3 deletions src/ui/composer/qgscomposerscalebarwidgetbase.ui
Expand Up @@ -262,7 +262,7 @@
</widget>
</item>
<item row="4" column="2">
<widget class="QgsSpinBox" name="mMaxWidthSpinBox">
<widget class="QgsDoubleSpinBox" name="mMaxWidthSpinBox">
<property name="enabled">
<bool>false</bool>
</property>
Expand All @@ -288,7 +288,7 @@
</widget>
</item>
<item row="3" column="2">
<widget class="QgsSpinBox" name="mMinWidthSpinBox">
<widget class="QgsDoubleSpinBox" name="mMinWidthSpinBox">
<property name="enabled">
<bool>false</bool>
</property>
Expand All @@ -304,7 +304,7 @@
</widget>
</item>
<item row="5" column="2">
<widget class="QgsSpinBox" name="mHeightSpinBox">
<widget class="QgsDoubleSpinBox" name="mHeightSpinBox">
<property name="suffix">
<string> mm</string>
</property>
Expand Down

0 comments on commit 474f39a

Please sign in to comment.