forked from qt-creator/qt-creator
CppEditor: Tell users about clangd configuration files
It's not feasible to map every possible setting into our UI, so instead teach people how to use the clangd configuration mechanism. Change-Id: Id11e81e25b687a4f49af4e090203faca3a75722d Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -39,6 +39,7 @@
|
||||
#include <utils/pathchooser.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QDesktopServices>
|
||||
#include <QFormLayout>
|
||||
#include <QGroupBox>
|
||||
#include <QHBoxLayout>
|
||||
@@ -341,6 +342,26 @@ ClangdSettingsWidget::ClangdSettingsWidget(const ClangdSettings::Data &settingsD
|
||||
// TODO: Remove once the concept is functional.
|
||||
d->sessionsGroupBox->hide();
|
||||
}
|
||||
|
||||
const auto configFilesHelpLabel = new QLabel;
|
||||
configFilesHelpLabel->setText(tr("Additional settings are available via "
|
||||
"<a href=\"https://clangd.llvm.org/config\"> clangd configuration files</a>.<br>"
|
||||
"General settings go <a href=\"%1\">here</a> "
|
||||
"and can be overridden per project by putting a .clangd file into "
|
||||
"the project source tree.")
|
||||
.arg(ClangdSettings::clangdUserConfigFilePath().toUserOutput()));
|
||||
connect(configFilesHelpLabel, &QLabel::linkHovered, configFilesHelpLabel, &QLabel::setToolTip);
|
||||
connect(configFilesHelpLabel, &QLabel::linkActivated, [](const QString &link) {
|
||||
if (link.startsWith("https"))
|
||||
QDesktopServices::openUrl(link);
|
||||
else
|
||||
Core::EditorManager::openEditor(Utils::FilePath::fromString(link));
|
||||
});
|
||||
const auto separator = new QFrame;
|
||||
separator->setFrameShape(QFrame::HLine);
|
||||
layout->addWidget(separator);
|
||||
layout->addWidget(configFilesHelpLabel);
|
||||
|
||||
layout->addStretch(1);
|
||||
|
||||
static const auto setWidgetsEnabled = [](QLayout *layout, bool enabled, const auto &f) -> void {
|
||||
|
||||
Reference in New Issue
Block a user