const QVariant &Settings::localValue(const QString &key, const QVariant &def) { QString normKey = normalizedKey(group, key); if(!isCached(normKey)) { create_qsettings; setCacheValue(normKey, s.value(normKey, def)); } return cacheValue(normKey); }
QVariant Settings::localValue(const QString& key, const QVariant& def) const { QString normKey = normalizedKey(_group, key); if (!isCached(normKey)) { create_qsettings; // Since we're loading from settings anyways, cache whether or not the key exists on disk setCacheKeyPersisted(normKey, s.contains(normKey)); // Cache key value setCacheValue(normKey, s.value(normKey, def)); } if (cacheKeyPersisted(normKey)) { return cacheValue(normKey); } // Don't return possibly wrong cached values // A key gets cached with the first default value requested and never changes afterwards return def; }