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]是保存配置文件。但我有很多。我如何將其加載並正確保存