On 17 Nov 2013, at 2:53 PM, Tim Hoffmann wrote:

> 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.

Whenever I used QSettings in widget-based applications, I ended up making a 
subclass for the purpose of having accessors for all the data types that the 
application needed (which can do the variant conversions), and any other 
missing features that the application needed.  You can probably add signals and 
slots too, to make it easier to wire up to various parts of the app.

BTW we have settings exposed to Qt Quick now.  If you try it, let us know if 
the API is complete enough to get done what you need to.

http://doc-snapshot.qt-project.org/qdoc/qml-qt-labs-settings-settings.html
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to