summaryrefslogtreecommitdiffstats
path: root/src/declarative/fx/qfxgridview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/declarative/fx/qfxgridview.cpp')
-rw-r--r--src/declarative/fx/qfxgridview.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/declarative/fx/qfxgridview.cpp b/src/declarative/fx/qfxgridview.cpp
index b429895..bf6e863 100644
--- a/src/declarative/fx/qfxgridview.cpp
+++ b/src/declarative/fx/qfxgridview.cpp
@@ -1254,6 +1254,7 @@ void QFxGridView::itemsInserted(int modelIndex, int count)
void QFxGridView::itemsRemoved(int modelIndex, int count)
{
Q_D(QFxGridView);
+ bool currentRemoved = d->currentIndex >= modelIndex && d->currentIndex < modelIndex + count;
int index = d->mapFromModel(modelIndex);
if (index == -1) {
if (modelIndex + count - 1 < d->visibleIndex) {
@@ -1269,7 +1270,7 @@ void QFxGridView::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;
@@ -1311,7 +1312,7 @@ void QFxGridView::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;