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

<snip>

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

Bye
-- 
Milian Wolff | milian.wo...@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

_______________________________________________
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to