forked from qt-creator/qt-creator
Added a method to remove individual tasks from the task window.
This commit is contained in:
@@ -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())
|
||||
|
@@ -99,6 +99,7 @@ public:
|
||||
void addCategory(const QString &categoryId, const QString &displayName);
|
||||
|
||||
void addTask(const Task &task);
|
||||
void removeTask(const Task &task);
|
||||
void clearTasks(const QString &categoryId = QString());
|
||||
|
||||
int taskCount(const QString &categoryId = QString()) const;
|
||||
|
Reference in New Issue
Block a user