diff --git a/src/plugins/projectexplorer/taskmodel.cpp b/src/plugins/projectexplorer/taskmodel.cpp index 6ceb5e8ffea..5c8a67cf475 100644 --- a/src/plugins/projectexplorer/taskmodel.cpp +++ b/src/plugins/projectexplorer/taskmodel.cpp @@ -327,9 +327,11 @@ void TaskModel::setFileNotFound(const QModelIndex &idx, bool b) ///// TaskFilterModel::TaskFilterModel(TaskModel *sourceModel, QObject *parent) : QAbstractItemModel(parent), - m_mappingUpToDate(false), m_sourceModel(sourceModel) + m_sourceModel(sourceModel) { Q_ASSERT(m_sourceModel); + updateMapping(); + connect(m_sourceModel, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(handleNewRows(QModelIndex,int,int))); connect(m_sourceModel, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)), @@ -472,15 +474,12 @@ QModelIndex TaskFilterModel::mapToSource(const QModelIndex &index) const void TaskFilterModel::invalidateFilter() { beginResetModel(); - m_mappingUpToDate = false; + updateMapping(); endResetModel(); } void TaskFilterModel::updateMapping() const { - if (m_mappingUpToDate) - return; - m_mapping.clear(); for (int i = 0; i < m_sourceModel->rowCount(); ++i) { QModelIndex index = m_sourceModel->index(i, 0); @@ -488,8 +487,6 @@ void TaskFilterModel::updateMapping() const if (filterAcceptsTask(task)) m_mapping.append(i); } - - m_mappingUpToDate = true; } bool TaskFilterModel::filterAcceptsTask(const Task &task) const diff --git a/src/plugins/projectexplorer/taskmodel.h b/src/plugins/projectexplorer/taskmodel.h index 7d6c1ae59ea..1032d6be43c 100644 --- a/src/plugins/projectexplorer/taskmodel.h +++ b/src/plugins/projectexplorer/taskmodel.h @@ -179,7 +179,6 @@ private: QList m_categoryIds; mutable QList m_mapping; - mutable bool m_mappingUpToDate; TaskModel *m_sourceModel; };