Skip to content
Permalink
Browse files
[composer] Don't round down scale for maps if < 1 (fix #9366)
  • Loading branch information
nyalldawson committed Jun 11, 2014
1 parent f46053d commit 32246087b29ecbeb963bb9d4119236e000f88343
Showing with 19 additions and 3 deletions.
  1. +18 −2 src/app/composer/qgscomposermapwidget.cpp
  2. +1 −1 src/core/composer/qgscomposermap.cpp
@@ -420,8 +420,24 @@ void QgsComposerMapWidget::updateGuiElements()
blockAllSignals( true );

//width, height, scale
// QRectF composerMapRect = mComposerMap->rect();
mScaleLineEdit->setText( QString::number( mComposerMap->scale(), 'f', 0 ) );
double scale = mComposerMap->scale();

//round scale to an appropriate number of decimal places
if ( scale >= 10 )
{
//round scale to integer if it's greater than 10
mScaleLineEdit->setText( QString::number( mComposerMap->scale(), 'f', 0 ) );
}
else if ( scale >= 1 )
{
//don't round scale if it's less than 10, instead use 4 decimal places
mScaleLineEdit->setText( QString::number( mComposerMap->scale(), 'f', 4 ) );
}
else
{
//if scale < 1 then use 10 decimal places
mScaleLineEdit->setText( QString::number( mComposerMap->scale(), 'f', 10 ) );
}

//preview mode
QgsComposerMap::PreviewMode previewMode = mComposerMap->previewMode();
@@ -781,7 +781,7 @@ void QgsComposerMap::setNewScale( double scaleDenominator )
{
double currentScaleDenominator = scale();

if ( scaleDenominator == currentScaleDenominator )
if ( scaleDenominator == currentScaleDenominator || scaleDenominator == 0 )
{
return;
}

0 comments on commit 3224608

Please sign in to comment.