QSettings
is a great class that works well for handling INI files. I would check it out. It has been optimized well, and is very robust. It also uses QVariant
in a very intelligent way. It also handles "Groups" well.
http://qt-project.org/doc/qt-4.8/qsettings.html
// in your main, or somewhere very early in your program
qApp->setApplicationName("Star Runner");
qApp->setOrganizationName("MySoft");
QSettings::setDefaultFormat(QSettings::IniFormat);
Later when you want to access or set a setting
QSettings s; // in windows this would be
// C:/Users/<username>/AppData/Roaming/MySoft/Star Runner.ini
Or you could specify your ini file this way to point at a specific ini file
QSettings::QSettings ( const QString & fileName, Format format, QObject * parent = 0 )
QSettings s("path/to/my/inifile.ini", QSettings::IniFormat);
And now an example of using the settings variable:
// set the setting
s.setValue("group_name/setting_name", new_value);
// retrieve the setting
// Note: Change "toType" to whatever type that this setting is supposed to be
current_value = s.value("group_name/setting_name", default_value).toType();
If you want to handle nested elements and gui layouts and design, I would look at XML or JSON. Both are supported by Qt.
XML is the native way that Qt Creator stores the UI files that are created by Qt Designer.
http://qt-project.org/doc/qt-5.0/qtxml/qtxml-module.html
http://qt-project.org/doc/qt-5.0/qtcore/json.html
Hope that helps.