ClangTools: Add diagnostic mark class

These marks can now be disabled.
This greys out the annotation color and the icon of the mark.

Change-Id: I5af4591db4baaaef55c986252f77d5d977427b56
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
David Schulz
2020-07-21 13:11:01 +02:00
parent 4314795992
commit 7f562c4d33
11 changed files with 258 additions and 129 deletions

View File

@@ -25,6 +25,8 @@
#include "clangtoolsdiagnostic.h"
#include <utils/utilsicons.h>
namespace ClangTools {
namespace Internal {
@@ -47,6 +49,19 @@ bool Diagnostic::isValid() const
return !description.isEmpty();
}
QIcon Diagnostic::icon() const
{
if (type == "warning")
return Utils::Icons::CODEMODEL_WARNING.icon();
if (type == "error" || type == "fatal")
return Utils::Icons::CODEMODEL_ERROR.icon();
if (type == "note")
return Utils::Icons::INFO.icon();
if (type == "fix-it")
return Utils::Icons::CODEMODEL_FIXIT.icon();
return {};
}
quint32 qHash(const Diagnostic &diagnostic)
{
return qHash(diagnostic.name)