Re: rs_settings
Posted by
ravas on
URL: https://forum.librecad.org/rs-settings-tp5712040p5712057.html
What does passing nullptr accomplish?
QSettings::value is what is determining if the "def" argument is returned.
There doesn't seem to be any reason to use QSettings::contains.
It seems like the function can be simplified to:
QString RS_Settings::readEntry(const QString& key, const QString& def)
{
if (!cache.count(key))
{
QSettings s(companyKey, appKey);
QVariant ret = s.value(QString("%1%2").arg(group).arg(key), QVariant(def));
cache[key]=ret;
}
return cache[key].toString();
}
The "ok" parameter and the readEntryCache function both seem worthless to me.