@@ -107,7 +107,7 @@ const QgsSettingsEntryBool *QgsSettingsRegistryCore::settingsLayerTreeShowFeatur
107
107
108
108
const QgsSettingsEntryBool *QgsSettingsRegistryCore::settingsEnableWMSTilePrefetching = new QgsSettingsEntryBool( QStringLiteral( " enable_wms_tile_prefetch" ), QgsSettingsTree::sTreeWms , false , QStringLiteral( " Whether to include WMS layers when rendering tiles adjacent to the visible map area" ) );
109
109
110
- const QgsSettingsEntryStringList *QgsSettingsRegistryCore::settingsMapScales = new QgsSettingsEntryStringList( QStringLiteral( " scales " ), QgsSettingsTree::sTreeMap , Qgis::defaultProjectScales().split( ' ,' ) );
110
+ const QgsSettingsEntryStringList *QgsSettingsRegistryCore::settingsMapScales = new QgsSettingsEntryStringList( QStringLiteral( " default_scales " ), QgsSettingsTree::sTreeMap , Qgis::defaultProjectScales().split( ' ,' ) );
111
111
112
112
113
113
QgsSettingsRegistryCore::QgsSettingsRegistryCore ()
@@ -150,10 +150,37 @@ void QgsSettingsRegistryCore::migrateOldSettings()
150
150
pal::Pal::settingsRenderingLabelCandidatesLimitLines->copyValueFromKey ( QStringLiteral ( " core/rendering/label_candidates_limit_lines" ), true );
151
151
pal::Pal::settingsRenderingLabelCandidatesLimitPolygons->copyValueFromKey ( QStringLiteral ( " core/rendering/label_candidates_limit_polygons" ), true );
152
152
153
- // migrate only one way for map scales
154
- if ( !settingsMapScales->exists () && QgsSettings ().contains ( QStringLiteral ( " Map/scales" ) ) )
155
- settingsMapScales->setValue ( QgsSettings ().value ( QStringLiteral ( " Map/scales" ) ).toString ().split ( ' ,' ) );
153
+ // handle bad migration - Fix profiles for old QGIS versions (restore the Map/scales key on windows)
154
+ if ( QgsSettings ().contains ( QStringLiteral ( " Map/scales" ) ) )
155
+ {
156
+ const QStringList oldScales = QgsSettings ().value ( QStringLiteral ( " Map/scales" ) ).toStringList ();
157
+ if ( ! oldScales.isEmpty () && !oldScales.at ( 0 ).isEmpty () )
158
+ QgsSettings ().setValue ( QStringLiteral ( " Map/scales" ), oldScales.join ( ' ,' ) );
159
+ else
160
+ QgsSettings ().setValue ( QStringLiteral ( " Map/scales" ), Qgis::defaultProjectScales () );
161
+ }
156
162
163
+ // migrate only one way for map scales
164
+ if ( !settingsMapScales->exists () )
165
+ {
166
+ // Handle bad migration. Prefer map/scales over Map/scales
167
+ const QStringList oldScales = QgsSettings ().value ( QStringLiteral ( " map/scales" ) ).toStringList ();
168
+ if ( ! oldScales.isEmpty () && !oldScales.at ( 0 ).isEmpty () )
169
+ {
170
+ // If migration has failed before (QGIS < 3.30.2), all scales might be
171
+ // concatenated in the first element of the list
172
+ QStringList actualScales;
173
+ for ( const QString &element : oldScales )
174
+ {
175
+ actualScales << element.split ( " ," );
176
+ }
177
+ settingsMapScales->setValue ( actualScales );
178
+ }
179
+ else if ( QgsSettings ().contains ( QStringLiteral ( " Map/scales" ) ) )
180
+ {
181
+ settingsMapScales->setValue ( QgsSettings ().value ( QStringLiteral ( " Map/scales" ) ).toString ().split ( ' ,' ) );
182
+ }
183
+ }
157
184
158
185
// digitizing settings - added in 3.30
159
186
{
0 commit comments