forked from qt-creator/qt-creator
make Tasks sortable
Sorting according to severity then id Reviewed-By: hunger
This commit is contained in:
@@ -65,6 +65,29 @@ bool operator==(const Task &t1, const Task &t2)
|
|||||||
return t1.taskId == t2.taskId;
|
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)
|
uint qHash(const Task &task)
|
||||||
{
|
{
|
||||||
return task.taskId;
|
return task.taskId;
|
||||||
|
@@ -76,8 +76,10 @@ private:
|
|||||||
static unsigned int s_nextId;
|
static unsigned int s_nextId;
|
||||||
};
|
};
|
||||||
|
|
||||||
bool operator==(const Task &t1, const Task &t2);
|
bool PROJECTEXPLORER_EXPORT operator==(const Task &t1, const Task &t2);
|
||||||
uint qHash(const Task &task);
|
uint PROJECTEXPLORER_EXPORT qHash(const Task &task);
|
||||||
|
|
||||||
|
bool PROJECTEXPLORER_EXPORT operator<(const Task &a, const Task &b);
|
||||||
|
|
||||||
} //namespace ProjectExplorer
|
} //namespace ProjectExplorer
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user