[Interest] Best practices for settings

Mandeep Sandhu mandeepsandhu.chd at gmail.com
Mon Nov 18 12:49:42 CET 2013


On Mon, Nov 18, 2013 at 5:03 PM, Philipp Kursawe <phil.kursawe at gmail.com> wrote:
> I am also currently struggling how to wire up changes to QSettings with the
> lack of signals/slots. Some of my plugins depend on global app settings but
> with QSettings its impossible for them to get notified about changes in
> settings.
> I thought subclassing QSettings is a good idea, until I found it it does not
> use virtual functions I could overload.

How about writing a wrapper class with QProperties for all the
settings you want to store. This class internally uses QSettings for
writing them to persistent storage. You'll have to make it a singleton
though. The notifications can come from the usual property changed
signals.

This way you can also control which properties are read-only and which
ones can be changed.

HTH,
-mandeep



More information about the Interest mailing list