Getting the profile setting using QT settings
-
up vote
0
down vote
favorite
I'm using the Qt settings and it saves the object into a file. it saves to a file called sessionrc.Now I'm trying to load the object from the settings and save it back.
The problem is I can not identify the object from the settings, so that I can load all the profiles that are saved.
I'm using the following load and save functionality
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); } }
The current setting file is
[www] Ta=20 Te=48 Texp=38 lim1=0 lim2=0 offset=0 profilename=www
[www] is the profile that is saved. but I have many of it. How would I load it back and save it correctly
-
Hi,
Are you looking for something like described in QSettings::beginWriteArray ?
-
I don't think so.
I have a profile class which has member variables that needs to be saved in the settings file and load them back.
I need it to be like that
[profiles]
[profilename1]
member variables[profilename2]
member variables