forked from qt-creator/qt-creator
Utils: Introduce variantFromStore and storeFromVariant
These are functional replacements for QVariant::fromValue(QVariantMap) (or QVariant::fromValue(Store)) and QVariant::toMap() (or QVariant::toValue<Store>()) We will have a few code paths in the end that need to explicitly operarate on both QVariantMap and Store (e.g. actual reading/writing to keep format compatibility etc), so these can't in the end be simple to/fromValue(OneType) but need an internal 'if' or such. Change-Id: I954f3cb24fa8fe123162b72bbd25d891dd19b768 Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
@@ -498,7 +498,7 @@ void ClangdProjectSettings::loadSettings()
|
||||
{
|
||||
if (!m_project)
|
||||
return;
|
||||
const Store data = m_project->namedSettings(clangdSettingsKey()).value<Store>();
|
||||
const Store data = storeFromVariant(m_project->namedSettings(clangdSettingsKey()));
|
||||
m_useGlobalSettings = data.value(clangdUseGlobalSettingsKey(), true).toBool();
|
||||
m_blockIndexing = data.value(clangdblockIndexingSettingsKey(), false).toBool();
|
||||
if (!m_useGlobalSettings)
|
||||
@@ -514,7 +514,7 @@ void ClangdProjectSettings::saveSettings()
|
||||
data = m_customSettings.toMap();
|
||||
data.insert(clangdUseGlobalSettingsKey(), m_useGlobalSettings);
|
||||
data.insert(clangdblockIndexingSettingsKey(), m_blockIndexing);
|
||||
m_project->setNamedSettings(clangdSettingsKey(), QVariant::fromValue(data));
|
||||
m_project->setNamedSettings(clangdSettingsKey(), variantFromStore(data));
|
||||
}
|
||||
|
||||
Store ClangdSettings::Data::toMap() const
|
||||
|
||||
Reference in New Issue
Block a user