[Development] Settings API for QML

Bache-Wiig Jens Jens.Bache-Wiig at digia.com
Tue Dec 11 16:37:23 CET 2012


> 
> To get the discussion going, here's my suggestion for that API:
> PersistentSettings
> {
>    property bool loadOnStartup: true
>    property bool saveOnExit: true
>    function load()
>    function save()
> }

I would also consider an even simpler API. How about we introduce a new keyword for persistent properties and make it part of the language.

Rectangle {
    id: root
    persistent property width: 400
    persistent property height: 300
}

What this means is that the application will automatically store its persistent properties on exit and recall those properties on startup. By default they would be initialised to the bound value.  
It will need some attached properties or other meta data to override default storage locations etc. And we also need to enforce id's to keep values unique per qml file. 

Jens


More information about the Development mailing list