Frage

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?

War es hilfreich?

Lösung

Set the format with: -

QSettings::setDefaultFormat(QSettings::NativeFormat);
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top