ProjectExplorer: Allow to add Tasks without TextMarks

This is needed for the Clang Code Model that will also put the
diagnostics into the issues pane. Because the Clang Code Model sets its
own TextMarks, duplications are avoided.

Change-Id: I668a271096cbcad44f03ad49c007ca1a18abc53c
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
Nikolai Kosjar
2018-04-12 17:15:40 +02:00
parent 7f2912b036
commit a1e3360236
3 changed files with 7 additions and 5 deletions

View File

@@ -57,8 +57,8 @@ unsigned int Task::s_nextId = 1;
Task::Task(TaskType type_, const QString &description_,
const Utils::FileName &file_, int line_, Core::Id category_,
const Utils::FileName &iconFile) :
taskId(s_nextId), type(type_), description(description_),
const Utils::FileName &iconFile, bool addTextMark) :
taskId(s_nextId), type(type_), addTextMark(addTextMark), description(description_),
file(file_), line(line_), movedLine(line_), category(category_),
icon(iconFile.isEmpty() ? taskTypeIcon(type_) : QIcon(iconFile.toString()))
{

View File

@@ -46,7 +46,7 @@ class TaskHub;
class PROJECTEXPLORER_EXPORT Task
{
public:
enum TaskType {
enum TaskType : char {
Unknown,
Error,
Warning
@@ -55,7 +55,8 @@ public:
Task() = default;
Task(TaskType type, const QString &description,
const Utils::FileName &file, int line, Core::Id category,
const Utils::FileName &iconName = Utils::FileName());
const Utils::FileName &iconName = Utils::FileName(),
bool addTextMark = true);
static Task compilerMissingTask();
static Task buildConfigurationMissingTask();
@@ -65,6 +66,7 @@ public:
unsigned int taskId = 0;
TaskType type = Unknown;
bool addTextMark = true;
QString description;
Utils::FileName file;
int line = -1;

View File

@@ -152,7 +152,7 @@ void TaskHub::addTask(Task task)
task.line = -1;
task.movedLine = task.line;
if (task.line != -1)
if (task.addTextMark && task.line != -1)
task.setMark(new TaskMark(task));
emit m_instance->taskAdded(task);
}