Skip to content
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 of writing/reading QSettings #1193

Merged
merged 3 commits into from
Feb 25, 2021
Merged

Fix of writing/reading QSettings #1193

merged 3 commits into from
Feb 25, 2021

Conversation

sklencar
Copy link
Contributor

closes issue related to not be able to save gspTolerance

@wonder-sk
Copy link
Contributor

What was the actual issue, why do we need to set NativeFormat? (and which one is the default normally?)

@sklencar
Copy link
Contributor Author

Actually it is super weird, because the default defaultFormat was NativeFormat. Also checked QSettings::scope as well as appname and organization. All seems to be set ok.
Also checked (just briefly) constructors of QSettings and QSettingsPrivate and it uses static QSettings::Format globalDefaultFormat = QSettings::NativeFormat;

If needed, I am happy to investigate it more what actually happen when DefaultFormat is set manually and what is difference from an empty constructor. It is not clear to me and of course it raises suspicious what is actually going on.

@wonder-sk
Copy link
Contributor

Yes please if you could have a look... it could be that when we initialize QGIS libs they do some magic with QSettings and override the default? (QGIS likes to use .ini format for settings)

Wrong order of initialization
@sklencar
Copy link
Contributor Author

Indeed, the problem was elsewhere - caused by messed up qgis init and initialization of AppSettings.
(https://github.com/lutraconsulting/input/pull/1119/files#diff-c1b709b8a90bef4573ddad8a9b2fbc5d5dbc85e4dc759f95b6d9905931fec24fR346)

@wonder-sk
Copy link
Contributor

Cool thanks. Can you maybe add a comment to AppSettings as; that says it should be created after qgis libs are initialized, so that next time we do not move it by mistake?

Copy link
Collaborator

@tomasMizera tomasMizera left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!
I do not know whether I understood the problem completely. If it was only about AppSettings not storing and reloading saved options, then this is working ✔️ . If anything else needs to be retested, let me know.

Maybe it would be a good idea to add manual test for QSettings - if they are actually being saved and reloaded. We can mess up things like this from time to time

@wonder-sk wonder-sk merged commit 55f9652 into master Feb 25, 2021
@PeterPetrik PeterPetrik deleted the qsettings_fix branch April 15, 2021 06:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants