Re: rs_settings
Posted by
dxli on
URL: https://forum.librecad.org/rs-settings-tp5712040p5712041.html
if the ok pointer is supplied (instead of an invalid ok=nullptr, which is false when converted to boolean), .i.e.
if(ok)
will check the ret part is read from an existing setting key, and return a true/false in the boolean pointed by *ok, .i.e.,
if(ok) {
*ok=s.contains(QString("%1%2").arg(group).arg(key));
}
ravas wrote
QString RS_Settings::readEntry(const QString& key,
const QString& def,
bool* ok) {
// lookup:
QVariant ret = readEntryCache(key);
if (!ret.isValid()) {
QSettings s(companyKey, appKey);
// RVT_PORT not supported anymore s.insertSearchPath(QSettings::Windows, companyKey);
if (ok) {
*ok=s.contains(QString("%1%2").arg(group).arg(key));
}
ret = s.value(QString("%1%2").arg(group).arg(key), QVariant(def));
cache[key]=ret;
}
return ret.toString();
}
What is the purpose of:
if (ok) {
*ok=s.contains(QString("%1%2").arg(group).arg(key));
}