Commit ed3f6e6d authored by Daniel Teske's avatar Daniel Teske

Optimize TaskModel::updateTaskLineNumber

Change-Id: I250b91d7dffa6a165765c08b77f004010e7fa8b3
Reviewed-by: default avatarTobias Hunger <tobias.hunger@nokia.com>
parent 0f853bb4
......@@ -150,12 +150,13 @@ void TaskModel::removeTask(const Task &task)
void TaskModel::updateTaskLineNumber(unsigned int id, int line)
{
for (int i = 0; i < m_tasks.count(); ++i) {
if (m_tasks.at(i).taskId == id) {
m_tasks[i].movedLine = line;
emit dataChanged(index(i, 0), index(i, 0));
return;
}
QList<Task>::iterator it = qLowerBound(m_tasks.begin(), m_tasks.end(), id, sortById);
QTC_ASSERT(it != m_tasks.end(), return)
int i = it - m_tasks.begin();
if (m_tasks.at(i).taskId == id) {
m_tasks[i].movedLine = line;
emit dataChanged(index(i, 0), index(i, 0));
return;
}
}
......
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