forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/8.0'
Change-Id: Icbb87ac8bcee5fb86042d3863a973573510651b4
This commit is contained in:
@@ -277,7 +277,7 @@ Task createTask(const ClangDiagnostic &diagnostic)
|
||||
|
||||
return Task(taskType,
|
||||
diagnosticCategoryPrefixRemoved(diagnostic.text),
|
||||
FilePath::fromString(diagnostic.location.targetFilePath.toString()),
|
||||
diagnostic.location.targetFilePath,
|
||||
diagnostic.location.targetLine,
|
||||
Constants::TASK_CATEGORY_DIAGNOSTICS,
|
||||
icon,
|
||||
@@ -295,7 +295,7 @@ ClangdTextMark::ClangdTextMark(const FilePath &filePath,
|
||||
, m_diagnostic(convertDiagnostic(ClangdDiagnostic(diagnostic), filePath))
|
||||
, m_client(client)
|
||||
{
|
||||
setSettingsPage(CppEditor::Constants::CPP_CODE_MODEL_SETTINGS_ID);
|
||||
setSettingsPage(CppEditor::Constants::CPP_CLANGD_SETTINGS_ID);
|
||||
|
||||
const bool isError = diagnostic.severity()
|
||||
&& *diagnostic.severity() == DiagnosticSeverity::Error;
|
||||
@@ -310,31 +310,32 @@ ClangdTextMark::ClangdTextMark(const FilePath &filePath,
|
||||
client->addTask(createTask(m_diagnostic));
|
||||
}
|
||||
|
||||
// Copy to clipboard action
|
||||
QVector<QAction *> actions;
|
||||
QAction *action = new QAction();
|
||||
action->setIcon(QIcon::fromTheme("edit-copy", Icons::COPY.icon()));
|
||||
action->setToolTip(tr("Copy to Clipboard", "Clang Code Model Marks"));
|
||||
QObject::connect(action, &QAction::triggered, [diag = m_diagnostic]() {
|
||||
const QString text = ClangDiagnosticWidget::createText({diag},
|
||||
ClangDiagnosticWidget::InfoBar);
|
||||
setClipboardAndSelection(text);
|
||||
});
|
||||
actions << action;
|
||||
|
||||
// Remove diagnostic warning action
|
||||
Project *project = projectForCurrentEditor();
|
||||
if (project && isDiagnosticConfigChangable(project, m_diagnostic)) {
|
||||
action = new QAction();
|
||||
action->setIcon(Icons::BROKEN.icon());
|
||||
action->setToolTip(tr("Disable Diagnostic in Current Project"));
|
||||
QObject::connect(action, &QAction::triggered, [diag = m_diagnostic]() {
|
||||
disableDiagnosticInCurrentProjectConfig(diag);
|
||||
setActionsProvider([diag = m_diagnostic] {
|
||||
// Copy to clipboard action
|
||||
QList<QAction *> actions;
|
||||
QAction *action = new QAction();
|
||||
action->setIcon(QIcon::fromTheme("edit-copy", Icons::COPY.icon()));
|
||||
action->setToolTip(tr("Copy to Clipboard", "Clang Code Model Marks"));
|
||||
QObject::connect(action, &QAction::triggered, [diag] {
|
||||
const QString text = ClangDiagnosticWidget::createText({diag},
|
||||
ClangDiagnosticWidget::InfoBar);
|
||||
setClipboardAndSelection(text);
|
||||
});
|
||||
actions << action;
|
||||
}
|
||||
|
||||
setActions(actions);
|
||||
// Remove diagnostic warning action
|
||||
Project *project = projectForCurrentEditor();
|
||||
if (project && isDiagnosticConfigChangable(project, diag)) {
|
||||
action = new QAction();
|
||||
action->setIcon(Icons::BROKEN.icon());
|
||||
action->setToolTip(tr("Disable Diagnostic in Current Project"));
|
||||
QObject::connect(action, &QAction::triggered, [diag] {
|
||||
disableDiagnosticInCurrentProjectConfig(diag);
|
||||
});
|
||||
actions << action;
|
||||
}
|
||||
return actions;
|
||||
});
|
||||
}
|
||||
|
||||
bool ClangdTextMark::addToolTipContent(QLayout *target) const
|
||||
|
||||
Reference in New Issue
Block a user