New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix new profile map scales #52580
Fix new profile map scales #52580
Conversation
well caught, sorry for this! |
@YoannQDQ, I've tested the MingW64 Windows 64bit Build of this PR. |
@@ -151,7 +151,7 @@ void QgsSettingsRegistryCore::migrateOldSettings() | |||
pal::Pal::settingsRenderingLabelCandidatesLimitPolygons->copyValueFromKey( QStringLiteral( "core/rendering/label_candidates_limit_polygons" ), true ); | |||
|
|||
// migrate only one way for map scales | |||
if ( !settingsMapScales->exists() ) | |||
if ( !settingsMapScales->exists() && QgsSettings().contains( QStringLiteral( "Map/scales" ) ) ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// handle bad migration (TODO remove in 3.32 or later)
if ( settingsMapScales->value() == QString( "" ) )
settingsMapScales->remove();
Adding this should fix former issues
It seems to me the behaviour with the new commit is the same as with the previous one: it fixes the issue using a new QGIS user profile with QGIS 3.31, while it doesn't fix the issue using a QGIS 3.28 user profile with QGIS 3.31 as described e.g. in #52383 (comment) and #52383 (comment). |
00e2bac
to
87b5c8b
Compare
Hopefuly fixed now. |
@YoannQDQ, now the list of scales that is set by an user in Settings->Options->Map Tools in QGIS 3.28 and previous versions, is completely removed by new versions of QGIS and substituted with the default predefined list of scales. |
87b5c8b
to
192b912
Compare
192b912
to
0b8409a
Compare
It seems to me now the reported issues (with a new user profile and with an old user profile) are completely fixed in the MingW64 Windows 64bit build of this PR. Thanks @YoannQDQ! @3nids do you know if there are other settings changed from QString to QStringList that needs a better handling like it was needed for the It remains open the question about the backward incompatibility: using a QGIS <= 3.28 user profile with QGIS >= 3.30.2 will permanently change the @3nids do you think the users should be made aware of such backward incompatibility of the |
Thanks a lot for this @YoannQDQ and @agiudiceandrea for the detailed report. There is no backward incompatibility since the settings keys are not the same (it's a migration). There are other QStringList based settings but I think they are not affected by this issue (I'll check this when I'll be back with a computer). Thanks again |
@3nids, it seems to me it is the same setting and I've checked that the very |
Strange, the section was changed from Map to map. I believe the case matters. And there is no deletion of the old setting in the migration. Can you check if both exist (upper and lower case section)? |
After opening a QGIS <= 3.28 user profile with QGIS from the MingW64 Windows 64bit build of this PR, there is only 1
QgsSettings().contains("qgis/style"), QgsSettings().contains("Qgis/Style"), QgsSettings().contains("QGIS/STYLE"), all return True and QgsSettings().value("qgis/style"), QgsSettings().value("Qgis/Style"), QgsSettings().value("QGIS/STYLE"), all return the same value, although there is only 1 |
Actually, it does on Ubuntu for instance, but not on Windows. So Windows users will encounter the problem @agiudiceandrea describes. We can either rename the sTreeMap key to something meaningful other than "map" (not too difficult since it isn't wide-spread yet) or rename the new map/scales property to |
I was thinking about renaming the node but we would need to check if other keys are using it which don't require migration. |
0b8409a
to
6327d1b
Compare
IMO We still need some kind of migration, from the |
@3nids Do you feel like this can now be merged? |
@YoannQDQ, it seems to me the issue is not yet fixed. In a QGIS <= 3.28 user profile, QGIS3.ini contains e.g.:
Using such user profile with QGIS from this PR (MingW64 Windows 64bit Build, actually from agiudiceandrea#104, because the MingW64 build here failed), QGIS3.ini contains:
and again... |
6327d1b
to
2fb8580
Compare
... You're right. Let's try again! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me.
Sorry for this and thanks a lot for fixing it!
@YoannQDQ, only now have I had the opportunity to test this PR.
For all the cases, the scales list modified by QGIS 3.28 and QGIS >= 3.30.2 will be stored in separate settings in the same user profile so the list read by QGIS 3.28 may be different from the list read by QGIS >= 3.30.2 for the same user profile. Anyway, now QGIS no longer crashes and the scales list in the old settings is preserved and it is correctly migrated from the old setting to the new setting, but only one-way (3.28 -> 3.30.2) while it seems to me it is not for the other way round (3.30.2 -> 3.28). @3nids, I'm concerned if there are other settings changed from QString to QStringList (or other type changing) that needs a better handling like it was needed for the |
Yes, migration is only forward and not backward for this one. It could be added now that we have changed the name of the keys. But is it really worth it?
as far as I remember and from a quick check now, no it's the only migration. There are other usages but they were already a list of strings. |
Thanks for checking. Since it is the only one, I think it would have been preferable to leave also such setting as it was, in order to avoid these issues. |
Description
This completes #52511 to fix issues regarding the map scale in QGIS 3.30.1
The map scale setting format has changed (QString -> QStringList). When QGIS launches, if the new setting do not exist, it is initailized from the old key. For new profiles however, the old key does not exist either, causing the default scales to be overwritten with an empty string (which also caused crashes, solved by #52511).
This PR checks if the old key actually exists before attempting to migrate it.