c++qtqt5qsettings

QSettings printout default value for specific key


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

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

Solution

  • 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.