Fix blank items in Issues pane

Even if source items are removed that are currently not visible, the
rest of the source mapping indices must be adapted.

Fixes: QTCREATORBUG-20542
Change-Id: Ib351286e6e7c35cdbdc96a3c38b346e8ed8f456c
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Eike Ziller
2018-11-22 10:12:21 +01:00
parent 30b522892c
commit bd493f963d

View File

@@ -437,12 +437,12 @@ void TaskFilterModel::handleRowsAboutToBeRemoved(const QModelIndex &index, int f
QTC_ASSERT(!index.isValid(), return);
const QPair<int, int> range = findFilteredRange(first, last, m_mapping);
if (range.first > range.second) // rows to be removed are filtered out
return;
beginRemoveRows(QModelIndex(), range.first, range.second);
m_beginRemoveRowsSent = true;
m_mapping.erase(m_mapping.begin() + range.first, m_mapping.begin() + range.second + 1);
if (range.first <= range.second) { // remove corresponding rows in filtermodel
beginRemoveRows(QModelIndex(), range.first, range.second);
m_beginRemoveRowsSent = true;
m_mapping.erase(m_mapping.begin() + range.first, m_mapping.begin() + range.second + 1);
}
// adapt existing mapping to removed source indices
const int sourceRemovedCount = (last - first) + 1;
for (int i = range.first; i < m_mapping.count(); ++i)
m_mapping[i] = m_mapping.at(i) - sourceRemovedCount;