[Development] Settings API for QML

Alberto Mardegan mardy at users.sourceforge.net
Wed Dec 12 09:36:25 CET 2012


On 12/12/2012 01:16 AM, Thiago Macieira wrote:
> On terça-feira, 11 de dezembro de 2012 15.55.52, Alan Alpert wrote:
>> Would you care to sketch out what your PersistentSettings element
>> would look like in practice?
>
> In a non QML approximant syntax:
>
> Rectangle {
>      PersistentSettings {
>          id: settings
>          property int width path("application.width")
>          property int height path("application.height")
>          property enum ButtonOrder buttonOrder path("system.buttonOrder")
>      }

What about:

PersistentSettings {
     id: settings
     propertyMap: {
         "width": "application.width",
         "height": "application.height",
         "buttonOrder": "system.buttonOrder"
     }
}

And have the PersistentSettings class create the "width", "height", 
"buttonOrder" properties dynamically. It doesn't need to know the type, 
because they are just QVariant (if the backend is implemented via 
QSettings, this all should be fairly easy to implement).

Ciao,
   Alberto




More information about the Development mailing list