[Development] Settings API for QML

Thiago Macieira thiago.macieira at intel.com
Wed Jul 31 19:48:16 CEST 2013

On quarta-feira, 31 de julho de 2013 08:38:54, Pier Luigi wrote:
> Here's my implementation which I started last year and finally managed
> to move into its own repo:
> https://github.com/hawaii-desktop/qtconfiguration


> It's still primitive but it's aimed at providing persistent storage
> and notifications for both C++ and QML.
> A JSON file would contain settings schema definition, here's a couple
> of examples:

Uh... what's a schema file and why is it necessary?

> https://github.com/hawaii-desktop/shell/blob/master/data/settings/org.hawaii
> .greenisland.json
> https://github.com/hawaii-desktop/vibe/blob/master/data/settings/org.hawaii
> .desktop.json.in

Hmm.. those look like input for a settings control module. That's not 
necessary in QtCore. I think it would be nice to have that as a separate 
module in Qt, which could replace KDE's KControl Module (KCM) support.

But schemas mustn't be required for storing settings.

> The QConfiguration class doesn't do much at the moment, it's just a
> dumb frontend to QSettings that checks whether a key exists in the
> schema and the value() method gets a default value from the schema
> when there's no value.

Why does it need to check the schema? If the value exists in the config file, 
then it exists. If it doesn't exist in the config file, the default is provided 
in the API call.

> Ideally the backend should be a plugin.

Yeah. On the other hand, I'm a bit skeptical about functionality requiring 
plugins in QtCore. At the very least, the dumbest backend should be built-in, 
not a plugin.

> There's no need to do yet another storage format for settings, we
> could use dconf on Linux, registry on Windows and plists on MacOS.

dconf cannot be the only option. We need a dumb and human-readable backend 
inside QtCore. As a maintainer, my guideline is INI format.

> If you think that the QConfiguration approach is fine maybe we can put
> it in the Playground.

That we can do.

Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/development/attachments/20130731/014fcfa7/attachment.sig>

More information about the Development mailing list