[Interest] Best practices for settings

André Somers andre at familiesomers.nl
Mon Nov 18 12:48:47 CET 2013


Hi Tim,

Tim Hoffmann schreef op 17-11-2013 14:53:
> Hi all,
>
> Are there any best practices for working with QSettings in larger
> projects with many settings?
>
> In particular:
> - How do you efficiently synchronize settings with widgets in an options
> dialog.
> - How do you efficiently detect changes made in an option dialog. (I
> have some options that need significant calculations after changing.
> These should only be triggered if the corresponding setting was actually
> changed.)
> - How do you access the settings in the source code? Always casting the
> QVariants seems a bit tedious but the alternative would be to have
> additional local variables (or members) for the values which you would
> have to maintain additionally.
>
> Thanks in advance.
>
Thanks for asking this question. I think it is an intersting topic.

Apart from the items on your list (which were already answered by 
several people), I'd like to raise another point here:
How do you deal with settings in the context of modularization of code? 
Our project is big enough that the code is separated into libraries. How 
do you deal with settings in that context? Do you have per-library 
settings, or do you have some kind of common settings system? How do you 
deal with using library-specific types as settings values?

André




More information about the Interest mailing list