summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2009-07-30 06:58:42 (GMT)
committerMartin Jones <martin.jones@nokia.com>2009-07-30 06:58:42 (GMT)
commit136c8210cc98bc6d9b17fd4d517d9d399f30e6c2 (patch)
treed1f1453564307875fdc94f86217c5b2035e68c3a /src
parent2ef98c315b4f0d92ef81f8452eef4c9f55f5eb08 (diff)
downloadQt-136c8210cc98bc6d9b17fd4d517d9d399f30e6c2.zip
Qt-136c8210cc98bc6d9b17fd4d517d9d399f30e6c2.tar.gz
Qt-136c8210cc98bc6d9b17fd4d517d9d399f30e6c2.tar.bz2
Don't bounce around when removing the current item.
Diffstat (limited to 'src')
-rw-r--r--src/declarative/fx/qfxlistview.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/declarative/fx/qfxlistview.cpp b/src/declarative/fx/qfxlistview.cpp
index 3d97dfa..a78fed5 100644
--- a/src/declarative/fx/qfxlistview.cpp
+++ b/src/declarative/fx/qfxlistview.cpp
@@ -278,6 +278,18 @@ public:
return -1;
}
+ int lastVisibleIndex() const {
+ int lastIndex = -1;
+ for (int i = visibleItems.count()-1; i >= 0; --i) {
+ FxListItem *listItem = visibleItems.at(i);
+ if (listItem->index != -1) {
+ lastIndex = listItem->index;
+ break;
+ }
+ }
+ return lastIndex;
+ }
+
// map a model index to visibleItems index.
// These may differ if removed items are still present in the visible list,
// e.g. doing a removal animation
@@ -542,7 +554,7 @@ void QFxListViewPrivate::layout()
pos += item->size();
}
// move current item if it is after the visible items.
- if (currentItem && currentIndex > visibleItems.last()->index)
+ if (currentItem && currentIndex > lastVisibleIndex())
currentItem->setPosition(currentItem->position() + (visibleItems.last()->endPosition() - oldEnd));
}
if (!isValid())
@@ -647,7 +659,8 @@ void QFxListViewPrivate::createHighlight()
const QLatin1String posProp(orient == Qt::Vertical ? "y" : "x");
highlightPosAnimator = new QmlFollow(q);
highlightPosAnimator->setTarget(QmlMetaProperty(highlight->item, posProp));
- highlightPosAnimator->setSpring(3);
+ highlightPosAnimator->setEpsilon(0.25);
+ highlightPosAnimator->setSpring(2.5);
highlightPosAnimator->setDamping(0.3);
highlightPosAnimator->setEnabled(autoHighlight);
const QLatin1String sizeProp(orient == Qt::Vertical ? "height" : "width");