Unsolved What is the best approach to save and restore widgets states?
-
For example, I am making desktop software and I want the user to be able to save a file (for example a project file) with the states of the widgets. Is QSetting a good option? Should I save it in some format like JSON to deserialize it later?
-
@efdiloreto
You have to write any code to de/serialize widgets yourself. The question is, just how much do you intend to store from each widget, because widgets have an awful lot of properties!QSettings
will store simple simplename=value
pairs. If you're going to store a lot of data, JSON would give you more power/flexibility. Note that you can store anyQSettings
individual value as/in JSON, so you can get the best of both worlds, i.e. the convenience ofQSettings
file/registry handling with the structured data of JSON. -
@JonB Thanks for the response. In that case I think I will do it with JSON. I only need to save / restore some widgets states and values.