Important: Please read the Qt Code of Conduct -

Proper QSettings Management

  • Hey there

    First I have a more philosophic question. The aim is to save all the interface variables and more (like window geometry, ...) of the software a user does. So that at the next startup everything is, as it was when he closed the application. Therefore you can use QSettings which is great. Now, what I ask myself is: Is it better to save all these settings at the end when the user quits the application or to catch every action like the user changes a value and to save the new value right then.

    First possibility keeps the code slimmer because you don't have to catch every action and also gives you a bit a better overview over your settings as the're gathered all around the same function. Second possibility bewares the user a bit better before data loss due to a system crash, because the settings are always on it's newest values.

    Second question is: As the application gets more complex, there arise more settings. And after a certain point it's getting quiet confusing to be sure, that everything is saved and is saved with the right key. With other words the overview suffers. What would be the most proper way to manage all your settings? Like have a separate table sheet where you write everything in or to use arrays to set up a nice syntax arrangement that it looks like a table in the source code?

    I'm quiet interested in the opinion and ideas other programmers do this. Thx for input!

Log in to reply