CppEditor: Simplify CppCodeModelSettings setup

Change-Id: Ie6849caf8ded2c0901a9d2daeda6a1f81b68ed72
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
hjk
2024-01-19 16:04:58 +01:00
parent 628560a60e
commit a6f57dc25e
8 changed files with 26 additions and 23 deletions

View File

@@ -68,6 +68,11 @@ static FilePath fallbackClangdFilePath()
return Environment::systemEnvironment().searchInPath("clangd");
}
CppCodeModelSettings::CppCodeModelSettings()
{
fromSettings(Core::ICore::settings());
}
void CppCodeModelSettings::fromSettings(QtcSettings *s)
{
s->beginGroup(Constants::CPPEDITOR_SETTINGSGROUP);
@@ -594,4 +599,10 @@ int ClangdSettings::Data::defaultCompletionResults()
return ok ? userValue : 100;
}
CppCodeModelSettings &cppCodeModelSettings()
{
static CppCodeModelSettings theCppCodeModelSettings;
return theCppCodeModelSettings;
}
} // namespace CppEditor