On terça-feira, 11 de dezembro de 2012 15.10.18, Alan Alpert wrote:
> The two-way binding would be tricky. You don't have a reference to the
> property and I'd prefer this not be baked into the language.
>
> But here's another way of doing roughly that:
> Rectangle {
>     Persistent.property("width", 400, "application.width");
>     Persistent.property("height");//Last value is the path to
> store/retrieve from, auto-chosen if left blank. Leave out default and
> you get 0/null/""
>     Persistent.properties: [ ["height",400], ["width",400,
> "application.width"] ] //Another possible attached property syntax.
> }
>
> The "Persistent" attached property knows which item it's attached to
> and the property name, so it can handle everything itself. Like it
> sets the property on startup and watches the change signal for when to
> update the persistent data (or just gets it again when it dies).

Please forgive me my lack of QML-fu here. What I'd like to have if I were
coding such an application would be something like:

 - load an element of type PersistentSettings or something
 - declare a list of property names, their types and their settings paths
   this is where I don't know the QML syntax

Then I should be able to use and modify the properties via
settings.propertyname. If the setting is modified, it might get saved at some
point. Moreover, if the policy is such that the setting is updated
synchronously from the backend, the application might react immediately to the
setting changing (à la GNOME and Mac OS X).

--
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center

Attachment: signature.asc
Description: This is a digitally signed message part.

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

Reply via email to