Question

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?

Was it helpful?

Solution

Set the format with: -

QSettings::setDefaultFormat(QSettings::NativeFormat);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top