[Development] QConfig update.

Milian Wolff milian.wolff at kdab.com
Wed Oct 15 12:22:32 CEST 2014

On Wednesday 15 October 2014 10:02:59 André Somers wrote:


> I think settings resemble properties to a very large extend. Perhaps it
> would, as an alternative to the XML or JSON schemes already suggested,
> but possible to build on the Qt property system instead for this. It is
> familiar to developers, does not require a special editor, and allows
> for using your own code instead of generated boilerplate quite naturally
> (point 4 above). Perhaps something like:
> class AppSettings: public QTypedConfig
> {
>     Q_SETTINGS(); // Q_OBJECT, but perhaps with some extra's like the
> ability to include generated function declarations for getters and setters
>     Q_SETTING(int width SETTING "dialog/window-width"  DEFAULT 800);
> //use generated getter, setter and notify
>     Q_SETTING(MyCustomType myValue READ myValue  WRITE setMyValue NOTIFY
> myValueChanged); //use custom getter and setter
> public:
>      AppSettings(QObject* parent = 0);
>      MyCustomType myValue() const;
>      void setMyValue(const MyCustomType& value);
>      Q_SIGNAL void myValueChanged(const MyCustomValue& value);
> }

I like the idea!

Milian Wolff | milian.wolff at kdab.com | Software Engineer
KDAB (Deutschland) GmbH&Co KG, a KDAB Group company
Tel. Germany +49-30-521325470, Sweden (HQ) +46-563-540090
KDAB - Qt Experts - Platform-independent software solutions

More information about the Development mailing list