Commit ed5f3aab authored by Peter Penz's avatar Peter Penz
Browse files

Fix filtering issue

When filtering items it might be possible that the update of
the widgets is wrong although the model internally has a correct
state.

BUG: 297269
FIXED-IN: 4.8.3
parent 352e2c59
......@@ -911,8 +911,13 @@ void KItemListView::slotItemsRemoved(const KItemRangeList& itemRanges)
m_layouter->markAsDirty();
int removedItemsCount = 0;
for (int i = 0; i < itemRanges.count(); ++i) {
removedItemsCount += itemRanges[i].count;
}
for (int i = itemRanges.count() - 1; i >= 0; --i) {
const KItemRange& range = itemRanges.at(i);
const KItemRange& range = itemRanges[i];
const int index = range.index;
const int count = range.count;
if (index < 0 || count <= 0) {
......@@ -924,7 +929,8 @@ void KItemListView::slotItemsRemoved(const KItemRangeList& itemRanges)
const int firstRemovedIndex = index;
const int lastRemovedIndex = index + count - 1;
const int lastIndex = m_model->count() + count - 1;
const int lastIndex = m_model->count() - 1 + removedItemsCount;
removedItemsCount -= count;
// Remove all KItemListWidget instances that got deleted
for (int i = firstRemovedIndex; i <= lastRemovedIndex; ++i) {
......
Supports Markdown
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