CppEditor: Show project-specific clangd settings conditionally

That is, only if the ClangCodeModel is enabled, as it was already done
for the global clangd settings. The current mix is an excellent way to
confuse users.

Change-Id: I1d3e7a366172ed972ac1ed04c4b332686a2ffb10
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
Christian Kandeler
2022-03-28 11:59:52 +02:00
parent f58add023a
commit 83f6c82752

View File

@@ -294,14 +294,6 @@ bool CppEditorPlugin::initialize(const QStringList & /*arguments*/, QString *err
tr("Insert \"#pragma once\" instead of \"#ifndef\" include guards into header file"),
[] { return usePragmaOnce() ? QString("true") : QString(); });
const auto clangdPanelFactory = new ProjectPanelFactory;
clangdPanelFactory->setPriority(100);
clangdPanelFactory->setDisplayName(tr("Clangd"));
clangdPanelFactory->setCreateWidgetFunction([](Project *project) {
return new ClangdProjectSettingsWidget(project);
});
ProjectPanelFactory::registerFactory(clangdPanelFactory);
const auto quickFixSettingsPanelFactory = new ProjectPanelFactory;
quickFixSettingsPanelFactory->setPriority(100);
quickFixSettingsPanelFactory->setId(Constants::QUICK_FIX_PROJECT_PANEL_ID);
@@ -441,8 +433,17 @@ void CppEditorPlugin::extensionsInitialized()
d->m_fileSettings.fromSettings(ICore::settings());
if (!d->m_fileSettings.applySuffixesToMimeDB())
qWarning("Unable to apply cpp suffixes to mime database (cpp mime types not found).\n");
if (CppModelManager::instance()->isClangCodeModelActive())
if (CppModelManager::instance()->isClangCodeModelActive()) {
d->m_clangdSettingsPage = new ClangdSettingsPage;
const auto clangdPanelFactory = new ProjectPanelFactory;
clangdPanelFactory->setPriority(100);
clangdPanelFactory->setDisplayName(tr("Clangd"));
clangdPanelFactory->setCreateWidgetFunction([](Project *project) {
return new ClangdProjectSettingsWidget(project);
});
ProjectPanelFactory::registerFactory(clangdPanelFactory);
}
// Add the hover handler factories here instead of in initialize()
// so that the Clang Code Model has a chance to hook in.