Applications of any reasonable size are likely to accumulate settings that need to be stored between sessions. Saving these settings usually involves a lot of tedious work with file operations and data serialization, and becomes even more complex when we want to do it in a way that works well across platforms. Qt rescues us from this work with its QtCore.QSettings class.
The QSettings class is a simple key-value data store that is automatically persisted in a platform-appropriate way. For example, on Windows, the settings are stored in the registry database, while on Linux they are placed in a plain-text configuration file under ~/.config.
Let's replace the settings dict object we created in our text editor with a QSettings object.
To create a QSettings object, we need to pass in a company name and application name, like this:
class MainWindow...