QML (only) Settings persistent storage

What is the current choice for persistent settings in qml only apps?

Can someone point me at an example?

[Qt.labs.settings 1.0 is referred to as depreciated in several places]

1 Like

Have you seen this? Works very well for me.


Thanks Attah,

Would you point me at a bit of your source repo where you use it, that would be a good starting point?

As an aside, this sort of documentation is what is so terribly wrong now. No examples of the actual code, but steaming piles of the totally self evident like this pearler:

ConfigurationValue provides access to a single DConf key. The DConf key value is accessible via the value property.

It’s like a bloody episode of Blackadder. Baldrick does documentation.

1 Like

you can also use good old sqlite openDatabaseSync

Here is an even more minimal example:

Groups are probably good practice, but i find myself just keeping a few individual booleans.
While an example would have been very awesome, and there is no excuse to not have one, i do think that information is also relevant, as what backs the settings storage is pretty good to know.


Start to be used with the sqlite database. In Qt sqlite is “LocalStorage”, the javascript version of sqlite. There are many examples online for “LocalStorage”.

It is a common error when you say “may app is small and I store only some data”. Your app will grow, you need a good structure from the beginning on.

Create a helper javascript file like “db.js”. Don’t forget “.import QtQuick.LocalStorage 2.0 as LS”.

Happy hacking!

1 Like

Indeed, for larger amounts of data LocalStorage is the way to go. I use it for anything with unknowable amounts of entries and where searching is needed etc. So given that, i have yet to find somewhere where ConfigurationGroups makes sense.

But i definitely think ConfigurationValue has its place still.

For an example of QML and JS only Local storage you could look at:

Startpage doing retrieval and feeding a ListModel:

The Javascript which also initializes if the DB is missing:

A search page which writes locations that are selected to the DB:

I studied the meteoswiss weather app to glean most of what I learned and cribbed code, of course.

There’s also Positioning, json api usage and custom Font usage, so a bit of stuff that might be useful.

Thanks All,
great examples, and it was in fact unexpectedly trivial to save a flag or too.