getting qsettings to work properly
Solved
General and Desktop
-
I have a profile which consists of Method names and its relation between each profile
void Method::loadFrom(Settings &set, bool ownGroup) { Settings s("profiles.ini"); s.beginGroup("Profiles"); foreach (const QString &group, s.childGroups()) { s.beginGroup(group + " "+ m_filename); Profile *profile = new Profile(); profile->setObjectName(group); profile->load(s); s.endGroup(); m_currentProfileManager->m_Profiles << profile; } EraObject::staticLoadFrom(set, this, ownGroup); } void Method::saveTo(Settings &set, bool ownGroup, bool force) { Settings s("profiles.ini"); s.beginGroup("Profiles"); foreach(Profile * profile, m_currentProfileManager->m_Profiles) { s.beginGroup(profile->profilename()); profile->save(s); s.endGroup(); } s.endGroup(); s.sync(); EraObject::staticSaveTo(set, this, ownGroup, force); } Now the current profile is [Profiles] %20Default\Ta=@Variant(\0\0\0\x87\x41\xa0\0\0) %20Default\Te=@Variant(\0\0\0\x87\x42@\0\0) %20Default\Texp=@Variant(\0\0\0\x87\x42\x18\0\0) %20Default\dirty=0 %20Default\lim1=@Variant(\0\0\0\x87\0\0\0\0) %20Default\lim2=@Variant(\0\0\0\x87\0\0\0\0) %20Default\objectName=" Default" %20Default\offset=@Variant(\0\0\0\x87\0\0\0\0) %20Default\profilename=" Default" yg\Ta=@Variant(\0\0\0\x87\x41\xa0\0\0) yg\Te=@Variant(\0\0\0\x87\x42@\0\0) yg\Texp=@Variant(\0\0\0\x87\x42\x18\0\0) yg\dirty=1 yg\lim1=@Variant(\0\0\0\x87\0\0\0\0) yg\lim2=@Variant(\0\0\0\x87\0\0\0\0) yg\objectName=yg yg\offset=@Variant(\0\0\0\x87\0\0\0\0) yg\profilename=yg yu\Ta=@Variant(\0\0\0\x87\x41\xa0\0\0) yu\Te=@Variant(\0\0\0\x87\x42@\0\0) yu\Texp=@Variant(\0\0\0\x87\x42\x18\0\0) yu\dirty=1 yu\lim1=@Variant(\0\0\0\x87\0\0\0\0) yu\lim2=@Variant(\0\0\0\x87\0\0\0\0) yu\objectName=yu yu\offset=@Variant(\0\0\0\x87\0\0\0\0) yu\profilename=yu
I have for each Method name a profile, here its default and yu.
I would like for each method name to generate its own profile and load it and save it. Currently all the methods load the same profile settings which is wrong.
I want each method to have its own set of profiles.
Method is just a qstring.
-
Hi,
Are you sure that all of your profiles contains different data besides the profile name ?
Can you share your implementation of load and save ?