Skip to content
Snippets Groups Projects
Commit 9ef4ea40 authored by dt's avatar dt
Browse files

make Tasks sortable

Sorting according to severity then id

Reviewed-By: hunger
parent 8ad48966
No related branches found
No related tags found
No related merge requests found
......@@ -65,6 +65,29 @@ bool operator==(const Task &t1, const Task &t2)
return t1.taskId == t2.taskId;
}
bool operator<(const Task &a, const Task &b)
{
if (a.type != b.type) {
if (a.type == ProjectExplorer::Task::Error)
return true;
if (b.type == ProjectExplorer::Task::Error)
return false;
if (a.type == ProjectExplorer::Task::Warning)
return true;
if (b.type == ProjectExplorer::Task::Warning)
return false;
// Can't happen
return true;
} else {
if (a.category < b.category)
return true;
if (b.category < a.category)
return false;
return a.taskId < b.taskId;
}
}
uint qHash(const Task &task)
{
return task.taskId;
......
......@@ -76,8 +76,10 @@ private:
static unsigned int s_nextId;
};
bool operator==(const Task &t1, const Task &t2);
uint qHash(const Task &task);
bool PROJECTEXPLORER_EXPORT operator==(const Task &t1, const Task &t2);
uint PROJECTEXPLORER_EXPORT qHash(const Task &task);
bool PROJECTEXPLORER_EXPORT operator<(const Task &a, const Task &b);
} //namespace ProjectExplorer
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment