diff options
author | David Schulz <david.schulz@qt.io> | 2021-06-28 12:21:30 +0200 |
---|---|---|
committer | David Schulz <david.schulz@qt.io> | 2021-06-29 04:45:47 +0000 |
commit | 44f0f9ae18346cbc08c80a811879a1a19726eee9 (patch) | |
tree | 959bbb6ace75ea8e8a5892c7599b4bc64474af57 /src/plugins/cpptools/cppcodemodelsettingspage.cpp | |
parent | 2d08b296b724c8e482d88e1b72840b1bd93d5475 (diff) | |
download | qt-creator-44f0f9ae18346cbc08c80a811879a1a19726eee9.tar.gz |
Clangd: use special value text for automatic worker count
Change-Id: Iddb75b6716724b5994d8093a8e389f5cb8e2d044
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src/plugins/cpptools/cppcodemodelsettingspage.cpp')
-rw-r--r-- | src/plugins/cpptools/cppcodemodelsettingspage.cpp | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/src/plugins/cpptools/cppcodemodelsettingspage.cpp b/src/plugins/cpptools/cppcodemodelsettingspage.cpp index f48f639d16..05b39cfea2 100644 --- a/src/plugins/cpptools/cppcodemodelsettingspage.cpp +++ b/src/plugins/cpptools/cppcodemodelsettingspage.cpp @@ -211,10 +211,8 @@ public: "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.")); - m_threadLimitCheckBox.setText(tr("Set worker thread count limit")); - m_threadLimitCheckBox.setChecked(ClangdSettings::workerThreadLimit() != 0); - m_threadLimitSpinBox.setMinimum(1); m_threadLimitSpinBox.setValue(ClangdSettings::workerThreadLimit()); + m_threadLimitSpinBox.setSpecialValueText("Automatic"); const auto layout = new QVBoxLayout(this); layout->addWidget(&m_useClangdCheckBox); @@ -226,7 +224,8 @@ public: const auto threadLimitLayout = new QHBoxLayout; threadLimitLayout->addWidget(&m_threadLimitSpinBox); threadLimitLayout->addStretch(1); - formLayout->addRow(&m_threadLimitCheckBox, threadLimitLayout); + const auto threadLimitLabel = new QLabel(tr("Set worker thread count:")); + formLayout->addRow(threadLimitLabel, threadLimitLayout); layout->addLayout(formLayout); layout->addStretch(1); @@ -235,15 +234,11 @@ public: m_clangdChooser.setEnabled(checked); indexingLabel->setEnabled(checked); m_indexingCheckBox.setEnabled(checked); - m_threadLimitCheckBox.setEnabled(checked); - m_threadLimitSpinBox.setEnabled(checked && m_threadLimitCheckBox.isChecked()); + m_threadLimitSpinBox.setEnabled(checked); }; connect(&m_useClangdCheckBox, &QCheckBox::toggled, toggleEnabled); - connect(&m_threadLimitCheckBox, &QCheckBox::toggled, - &m_threadLimitSpinBox, &QSpinBox::setEnabled); toggleEnabled(m_useClangdCheckBox.isChecked()); - m_threadLimitSpinBox.setEnabled(m_useClangdCheckBox.isChecked() - && m_threadLimitCheckBox.isChecked()); + m_threadLimitSpinBox.setEnabled(m_useClangdCheckBox.isChecked()); } private: @@ -253,14 +248,12 @@ private: data.useClangd = m_useClangdCheckBox.isChecked(); data.executableFilePath = m_clangdChooser.filePath(); data.enableIndexing = m_indexingCheckBox.isChecked(); - data.workerThreadLimit = m_threadLimitCheckBox.isChecked() - ? m_threadLimitSpinBox.value() : 0; + data.workerThreadLimit = m_threadLimitSpinBox.value(); ClangdSettings::setData(data); } QCheckBox m_useClangdCheckBox; QCheckBox m_indexingCheckBox; - QCheckBox m_threadLimitCheckBox; QSpinBox m_threadLimitSpinBox; Utils::PathChooser m_clangdChooser; }; |