diff options
author | Erik Verbruggen <erik.verbruggen@nokia.com> | 2010-04-16 12:41:26 +0200 |
---|---|---|
committer | Erik Verbruggen <erik.verbruggen@nokia.com> | 2010-04-16 12:54:59 +0200 |
commit | fb9a9ceede0d872742c44462292626475df9f145 (patch) | |
tree | 310f79657177848aaad77512920f9f15686a4c6b /src/plugins/projectexplorer/taskwindow.cpp | |
parent | 61b3a7beb81ef813368766c672d95a68cfdf17f5 (diff) | |
download | qt-creator-fb9a9ceede0d872742c44462292626475df9f145.tar.gz |
Added a method to remove individual tasks from the task window.
Diffstat (limited to 'src/plugins/projectexplorer/taskwindow.cpp')
-rw-r--r-- | src/plugins/projectexplorer/taskwindow.cpp | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/src/plugins/projectexplorer/taskwindow.cpp b/src/plugins/projectexplorer/taskwindow.cpp index a26b27376f..ab407b0683 100644 --- a/src/plugins/projectexplorer/taskwindow.cpp +++ b/src/plugins/projectexplorer/taskwindow.cpp @@ -116,6 +116,7 @@ public: QList<Task> tasks(const QString &categoryId = QString()) const; void addTask(const Task &task); + void removeTask(const Task &task); void clearTasks(const QString &categoryId = QString()); int sizeOfFile(); @@ -253,15 +254,16 @@ void TaskModel::addTask(const Task &task) m_maxSizeOfFileName = qMax(m_maxSizeOfFileName, fm.width(filename)); } -// -//void TaskModel::removeTask(const ITaskWindow::Task &task) -//{ -// Q_ASSERT(m_tasks.contains(task)); -// int index = m_tasks.indexOf(task); -// beginRemoveRows(QModelIndex(), index, index); -// m_tasks.removeAt(index); -// endRemoveRows(); -//} + +void TaskModel::removeTask(const Task &task) +{ + if (m_tasks.contains(task)) { + int index = m_tasks.indexOf(task); + beginRemoveRows(QModelIndex(), index, index); + m_tasks.removeAt(index); + endRemoveRows(); + } +} void TaskModel::clearTasks(const QString &categoryId) { @@ -557,6 +559,15 @@ void TaskWindow::addTask(const Task &task) navigateStateChanged(); } +void TaskWindow::removeTask(const Task &task) +{ + m_model->removeTask(task); + + updateActions(); + emit tasksChanged(); + navigateStateChanged(); +} + void TaskWindow::showTaskInFile(const QModelIndex &index) { if (!index.isValid()) |