我希望qtsettings加载和保存配置文件类对象,如下面的列表所示
[profiles]
[profilename1]
data
[profilename2]
data
答案 0 :(得分:2)
QSettings settings("myapp.ini", QSettings::IniFormat);
settings.beginGroup("profiles");
settings.beginGroup("profilename1");
settings.setValue("value", QString("data"));
settings.endGroup();
settings.beginGroup("profilename2");
settings.setValue("value", QString("data"));
settings.endGroup();
settings.endGroup();