How to clear the value of a QSettings
-
I use this statement to invalidate the value of a QSettings @mySettings.value ("code"). Clear ();@
But when I do @if (! mySettings.value ("code"). IsValid ())@ it returns trueHow can I do?
-
i think you have to call sync() in between. that forces the settings to be written on disk. and you call 2 different setting values that might also be the problem :)
-
mySettings.value() returns a QVariant. So you clear the contents of the returned variant, not the settings.
You should try:
@
mySettings.remove("code");
@This removes the key and its value from the QSettings object. A sync() is not necessary.