summaryrefslogtreecommitdiff
path: root/src/plugins/cpptools/cppcodemodelsettingspage.cpp
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2021-06-25 17:40:20 +0200
committerChristian Kandeler <christian.kandeler@qt.io>2021-06-28 10:35:06 +0000
commit876cd8e9755aff5bb69264f9aa0c5210b23b3920 (patch)
tree200ad6fb4b424afd4eb63de581ec5696c355e831 /src/plugins/cpptools/cppcodemodelsettingspage.cpp
parentba138a185534269f6a6f32088965b12cbb898337 (diff)
downloadqt-creator-876cd8e9755aff5bb69264f9aa0c5210b23b3920.tar.gz
Clangd: Allow to switch off background indexing
It is conceivable that users don't want to spend the extra CPU time on this. Change-Id: Ic3611c8d17d201ae986fad08b344369a8728ce1b Reviewed-by: David Schulz <david.schulz@qt.io>
Diffstat (limited to 'src/plugins/cpptools/cppcodemodelsettingspage.cpp')
-rw-r--r--src/plugins/cpptools/cppcodemodelsettingspage.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/plugins/cpptools/cppcodemodelsettingspage.cpp b/src/plugins/cpptools/cppcodemodelsettingspage.cpp
index 7d9fc2078e..d3a75af0cb 100644
--- a/src/plugins/cpptools/cppcodemodelsettingspage.cpp
+++ b/src/plugins/cpptools/cppcodemodelsettingspage.cpp
@@ -205,18 +205,27 @@ public:
m_clangdChooser.setExpectedKind(Utils::PathChooser::ExistingCommand);
m_clangdChooser.setFilePath(ClangdSettings::clangdFilePath());
m_clangdChooser.setEnabled(m_useClangdCheckBox.isChecked());
+ m_indexingCheckBox.setChecked(ClangdSettings::indexingEnabled());
+ m_indexingCheckBox.setToolTip(tr(
+ "If background indexing is enabled, global symbol searches will yield\n"
+ "more accurate results, at the cost of additional CPU load when\n"
+ "the project is first opened."));
const auto layout = new QVBoxLayout(this);
layout->addWidget(&m_useClangdCheckBox);
const auto formLayout = new QFormLayout;
const auto chooserLabel = new QLabel(tr("Path to executable:"));
formLayout->addRow(chooserLabel, &m_clangdChooser);
+ const auto indexingLabel = new QLabel(tr("Enable background indexing:"));
+ formLayout->addRow(indexingLabel, &m_indexingCheckBox);
layout->addLayout(formLayout);
layout->addStretch(1);
const auto toggleEnabled = [=](const bool checked) {
chooserLabel->setEnabled(checked);
m_clangdChooser.setEnabled(checked);
+ indexingLabel->setEnabled(checked);
+ m_indexingCheckBox.setEnabled(checked);
};
connect(&m_useClangdCheckBox, &QCheckBox::toggled, toggleEnabled);
toggleEnabled(m_useClangdCheckBox.isChecked());
@@ -228,10 +237,12 @@ private:
ClangdSettings::Data data;
data.useClangd = m_useClangdCheckBox.isChecked();
data.executableFilePath = m_clangdChooser.filePath();
+ data.enableIndexing = m_indexingCheckBox.isChecked();
ClangdSettings::setData(data);
}
QCheckBox m_useClangdCheckBox;
+ QCheckBox m_indexingCheckBox;
Utils::PathChooser m_clangdChooser;
};