Commit d807b14c authored by dt's avatar dt
Browse files

Make TaskModel 2.5x faster

parent fc67c5ca
......@@ -250,9 +250,13 @@ void TaskModel::addTask(const Task &task)
{
Q_ASSERT(m_categories.keys().contains(task.category));
QList<Task> tasksInCategory = m_tasksInCategory.value(task.category);
tasksInCategory.append(task);
m_tasksInCategory.insert(task.category, tasksInCategory);
if (m_tasksInCategory.contains(task.category)) {
m_tasksInCategory[task.category].append(task);
} else {
QList<Task> temp;
temp.append(task);
m_tasksInCategory.insert(task.category, temp);
}
beginInsertRows(QModelIndex(), m_tasks.size(), m_tasks.size());
m_tasks.append(task);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment