QSettings printout default value for specific key

185 Views Asked by At

Is there a way to printout what is the default value for a specific key?

int v = settings.value("key", defaultValue).toInt();
qDebug() << ...
2

There are 2 best solutions below

0
vahancho On BEST ANSWER

QSettings object doesn't store default values associated with the keys. According to the QSettings::value() function description if setting doesn't exist, the function returns the given default value - the one you already know and put as a function parameter.

0
ali akbari On

QSetting is something like Dictionary that remain after closing your builded Qt project! you will add a key and a value for it and it will be there for you for next ussage and so on! so if you dont set value and key there is no default value for you !