Solved Trouble with .ini settings file
-
I have ab .ini file structured like this:
[theme]
background=#000000
text=#87ca00
border=#87ca00
slider=#ffff7fI need to retrieve the value of each key. This is my attempt
settings = new QSettings(QDir::currentPath() + "/config.ini", QSettings::IniFormat); settings->beginGroup("theme"); QStringList keys = settings->childKeys(); for (int i=0; i < keys.size(); i++) { QString value = "theme/"; value.append(keys.at(i)); qDebug() << "key" << keys.at(i) << settings->value(value).toString(); } settings->endGroup();
The output is
key "background" ""
key "border" ""
key "slider" ""
key "text" ""As you can see, the text corresponding to the key value is empty.
Where am I doing wrong? -
@UnitScan said in Trouble with .ini settings file:
QString value = "theme/";
You already called beginGroup() within this.
-
Very well, thank you!