Qt Settings

Objectives

  • Know how to store application settings in different formats with the help of QSettings
  • Be aware of and be able to control the storage location of settings on different platforms

QSettings

  • The QSettings class provides persistent platform-independent application settings.
  • Users normally expect an application to remember its settings (window sizes and positions, options, etc.) across sessions. This information is often stored in the system registry on Windows, and in XML preferences files on Mac OS X. On Unix systems, in the absence of a standard, many applications (including the KDE applications) use INI text files.

Reading and Writing settings

  • QSettings stores settings.
  • Each setting consists of a QString that specifies the setting's name (the key) and a QVariant that stores the data associated with the key.
  • To write a setting, use setValue().
  • You can get a setting's value back using value()

Settings in Different Platforms

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-Share Alike 2.5 License.