Reputation: 29441
I store my settings using QSettings
class and sometimes, it gives me a strange behavior.
I use this to add a value :
QSettings _settings("MyCompany", "AppName")
_settings.setValue("lastfile", "SomeString");
And this to remove all values :
QStringList indexes = _settings.allKeys();
foreach(QString index, indexes)
_settings->remove(index);
And it seems to work randomly. Sometimes it add or remove the value to the .plist
file (I checked it using _settings.fileName()
) and sometimes nothing change.
My question, which is kind of implicit, is what am I missing and how to make it work normally?
Upvotes: 2
Views: 894
Reputation: 27611
Set the format with: -
QSettings::setDefaultFormat(QSettings::NativeFormat);
Upvotes: 2