【Proposal】
- read/parse ini file。
【Code and Related-file】
- data.ini
[profile] name= sam lee brithday= 1980/01/01
- include define
#include <QtDebug> #include <QSettings>
- code
QSettings settings("data.ini", QSettings::IniFormat); settings.beginGroup("profile"); const QStringList childKeys = settings.childKeys(); foreach (const QString &childKey, childKeys) qDebug() << settings.value(childKey); settings.endGroup();
【Result】
- Result
QVariant(QString, "1980/01/01") QVariant(QString, "sam lee")
【Question】
- How to create ini file If file not exist?
【Reference】
- How to use QSettings to read INI file
http://www.qtcentre.org/threads/21473-How-to-use-QSettings-to-read-INI-file