0
我正在使用Qt设置并将对象保存到文件中。它保存到一个名为sessionrc的文件中。使用QT设置获取配置文件设置
现在我试图从设置中加载对象并保存。
问题是我无法从设置中识别对象,以便我可以加载保存的所有配置文件。
我使用下面的加载和保存功能
void ProfileManager::loadFrom(Settings &set, bool ownGroup)
{
qDebug()<<"LOAD";
foreach (const QString &group, set.childGroups()) {
if(group == "Profile")
{
Profile *profile = new Profile();
profile->setObjectName(group);
profile->loadFrom(set);
m_Profiles << profile;
}
}
EraObject::staticLoadFrom(set, this);
}
void ProfileManager::saveTo(Settings &set, bool ownGroup, bool force)
{
EraObject::staticSaveTo(set, this, ownGroup, force);
foreach(Profile * profile, m_Profiles) {
profile->saveTo(set);
}
}
当前的设置文件是
[www]
Ta=20
Te=48
Texp=38
lim1=0
lim2=0
offset=0
profilename=www
[WWW]是保存配置文件。但我有很多。我如何将其加载并正确保存