Optimal way to access QSettings
-
Hello,
I have applications where I need to work with user defined values (in QSettings) and my application supports dynamically change settings during runtime (using Settings window).I would like to ask you what is optimal way to work with QSettings, I know to options:
- At start load all settings into one object (struct) and use that object for getting values, if I change settings then I save new settings into QSettings and settings object.
- Everywhere in application I will always get value from QSettings directly.
-
Hi,
Do you have all settings of your app managed in that
dialog ?How is it designed ?
-
One way is to have your settings widget emitting signals to update your other widgets. That way when you load the settings into the settings widget it will propagate to the others. You'll have one central of truth for your application.
The other possibility is the other way around, each widget is responsible for managing it's own settings and your dialog allows to change them. Store the latest settings on application end for example.