UI: Settings: Fix cached values' keys

This commit is contained in:
Nodir Temirkhodjaev 2023-03-19 12:21:57 +03:00
parent b56e51f113
commit 5cd35537f3

View File

@ -96,7 +96,10 @@ QVariant Settings::iniValue(const QString &key, const QVariant &defaultValue) co
return QVariant(); return QVariant();
// Try to load from cache // Try to load from cache
const auto cachedValue = cacheValue(key); const QString group = m_ini->group();
const QString cachedKey = group.isEmpty() ? key : group + '/' + key;
const QVariant cachedValue = cacheValue(cachedKey);
if (!cachedValue.isNull()) if (!cachedValue.isNull())
return cachedValue; return cachedValue;
@ -104,7 +107,7 @@ QVariant Settings::iniValue(const QString &key, const QVariant &defaultValue) co
const auto value = m_ini->value(key, defaultValue); const auto value = m_ini->value(key, defaultValue);
// Save to cache // Save to cache
setCacheValue(key, value); setCacheValue(cachedKey, value);
return value; return value;
} }