diff --git a/src/app/qgsmapcanvasdockwidget.cpp b/src/app/qgsmapcanvasdockwidget.cpp index c8f5f75718853..752befc06cd75 100644 --- a/src/app/qgsmapcanvasdockwidget.cpp +++ b/src/app/qgsmapcanvasdockwidget.cpp @@ -30,6 +30,7 @@ #include "qgsvectorlayer.h" #include "qgsapplication.h" #include "qgsdockablewidgethelper.h" +#include "qgsprojectviewsettings.h" #include #include @@ -590,6 +591,22 @@ QgsMapSettingsAction::QgsMapSettingsAction( QWidget *parent ) gLayout->addWidget( label, 2, 0 ); mScaleCombo = new QgsScaleComboBox(); + // use either global scales or project scales + if ( QgsProject::instance()->viewSettings()->useProjectScales() ) + { + const QVector< double > scales = QgsProject::instance()->viewSettings()->mapScales(); + QStringList textScales; + textScales.reserve( scales.size() ); + for ( const double scale : scales ) + textScales << QStringLiteral( "1:%1" ).arg( QLocale().toString( scale, 'f', 0 ) ); + mScaleCombo->updateScales( textScales ); + } + else + { + // use global scales + mScaleCombo->updateScales(); + } + gLayout->addWidget( mScaleCombo, 2, 1 ); mRotationWidget = new QgsDoubleSpinBox(); diff --git a/src/gui/qgstextformatwidget.cpp b/src/gui/qgstextformatwidget.cpp index b9f99bcf0599c..cbc98d3168a18 100644 --- a/src/gui/qgstextformatwidget.cpp +++ b/src/gui/qgstextformatwidget.cpp @@ -43,6 +43,7 @@ #include "qgssymbollayerreference.h" #include "qgsconfig.h" #include "qgsprojectstylesettings.h" +#include "qgsprojectviewsettings.h" #include #include @@ -849,6 +850,24 @@ void QgsTextFormatWidget::populateDataDefinedButtons() registerDataDefinedButton( mScaleBasedVisibilityMaxDDBtn, QgsPalLayerSettings::Property::MaximumScale ); mScaleBasedVisibilityMaxDDBtn->setUsageInfo( ddScaleVisInfo ); + // use either global scales or project scales + if ( QgsProject::instance()->viewSettings()->useProjectScales() ) + { + const QVector< double > scales = QgsProject::instance()->viewSettings()->mapScales(); + QStringList textScales; + textScales.reserve( scales.size() ); + for ( const double scale : scales ) + textScales << QStringLiteral( "1:%1" ).arg( QLocale().toString( scale, 'f', 0 ) ); + mMinScaleWidget->updateScales( textScales ); + mMaxScaleWidget->updateScales( textScales ); + } + else + { + // use global scales + mMinScaleWidget->updateScales(); + mMaxScaleWidget->updateScales(); + } + registerDataDefinedButton( mFontLimitPixelDDBtn, QgsPalLayerSettings::Property::FontLimitPixel ); mFontLimitPixelDDBtn->registerCheckedWidget( mFontLimitPixelChkBox ); registerDataDefinedButton( mFontMinPixelDDBtn, QgsPalLayerSettings::Property::FontMinPixel );