diff --git a/src/app/layout/qgslayoutmapwidget.cpp b/src/app/layout/qgslayoutmapwidget.cpp index c337dc96f5e9..3ae8af265322 100644 --- a/src/app/layout/qgslayoutmapwidget.cpp +++ b/src/app/layout/qgslayoutmapwidget.cpp @@ -483,7 +483,7 @@ void QgsLayoutMapWidget::mScaleLineEdit_editingFinished() return; } - if ( std::round( scaleDenominator ) == std::round( mMapItem->scale() ) ) + if ( qgsDoubleNear( scaleDenominator, mMapItem->scale() ) ) return; mMapItem->layout()->undoStack()->beginCommand( mMapItem, tr( "Change Map Scale" ) ); @@ -604,11 +604,15 @@ void QgsLayoutMapWidget::updateGuiElements() double scale = mMapItem->scale(); //round scale to an appropriate number of decimal places - if ( scale >= 10 ) + if ( scale >= 10000 ) { - //round scale to integer if it's greater than 10 + //round scale to integer if it's greater than 10000 mScaleLineEdit->setText( QLocale().toString( mMapItem->scale(), 'f', 0 ) ); } + else if ( scale >= 10 ) + { + mScaleLineEdit->setText( QLocale().toString( mMapItem->scale(), 'f', 3 ) ); + } else if ( scale >= 1 ) { //don't round scale if it's less than 10, instead use 4 decimal places