diff options
author | Martin Jones <martin.jones@nokia.com> | 2009-08-27 07:07:12 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2009-08-27 07:07:12 (GMT) |
commit | f80f58b857d1fa9ad53ba6780daaaafa1c4b1111 (patch) | |
tree | dec4f6853ca8f8d17bbbf299c23cf640f99a61d5 /src/declarative/fx/qfxlistview.cpp | |
parent | 84ab1ebab17e62176db1120845d0a3ece5cf9d80 (diff) | |
download | Qt-f80f58b857d1fa9ad53ba6780daaaafa1c4b1111.zip Qt-f80f58b857d1fa9ad53ba6780daaaafa1c4b1111.tar.gz Qt-f80f58b857d1fa9ad53ba6780daaaafa1c4b1111.tar.bz2 |
Make sure current item is released when removed but not visible.
Diffstat (limited to 'src/declarative/fx/qfxlistview.cpp')
-rw-r--r-- | src/declarative/fx/qfxlistview.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/declarative/fx/qfxlistview.cpp b/src/declarative/fx/qfxlistview.cpp index 0dfdce8..c1e03dd 100644 --- a/src/declarative/fx/qfxlistview.cpp +++ b/src/declarative/fx/qfxlistview.cpp @@ -1522,6 +1522,7 @@ void QFxListView::itemsRemoved(int modelIndex, int count) { Q_D(QFxListView); d->updateUnrequestedIndexes(); + bool currentRemoved = d->currentIndex >= modelIndex && d->currentIndex < modelIndex + count; if (!d->mapRangeFromModel(modelIndex, count)) { if (modelIndex + count - 1 < d->visibleIndex) { // Items removed before our visible items. @@ -1536,7 +1537,7 @@ void QFxListView::itemsRemoved(int modelIndex, int count) d->currentIndex -= count; if (d->currentItem) d->currentItem->index -= count; - } else if (d->currentIndex >= modelIndex && d->currentIndex < modelIndex + count) { + } else if (currentRemoved) { // current item has been removed. d->releaseItem(d->currentItem); d->currentItem = 0; @@ -1579,8 +1580,9 @@ void QFxListView::itemsRemoved(int modelIndex, int count) d->currentIndex -= count; if (d->currentItem) d->currentItem->index -= count; - } else if (d->currentIndex >= modelIndex && d->currentIndex < modelIndex + count) { + } else if (currentRemoved) { // current item has been removed. + d->currentItem->attached->setIsCurrentItem(false); d->releaseItem(d->currentItem); d->currentItem = 0; d->currentIndex = -1; |