From 2b779fbd25aaf09897ee2cdc4edffd12a980420b Mon Sep 17 00:00:00 2001 From: Alberto Mardegan Date: Tue, 10 Nov 2015 15:42:23 +0200 Subject: Don't make currentIndex skip an extra item on removal Improve the logic for determining the desired viewport position, which got partially broken with 134d980a7fcf61c5440019bcfb3fdfc39c3f5f3c. Let's not alter topItem and bottomItem if their index appears to be correct. Task-number: QTBUG-49330 Change-Id: Ib1c88de51be28cbb0afb1741440adb03ae8ebd87 Reviewed-by: Albert Astals Cid Reviewed-by: J-P Nurmi --- src/quick/items/qquicklistview.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/quick/items/qquicklistview.cpp') diff --git a/src/quick/items/qquicklistview.cpp b/src/quick/items/qquicklistview.cpp index 2958c0a67a..0211e9f285 100644 --- a/src/quick/items/qquicklistview.cpp +++ b/src/quick/items/qquicklistview.cpp @@ -1479,13 +1479,13 @@ void QQuickListViewPrivate::fixup(AxisData &data, qreal minExtent, qreal maxExte tempPosition -= bias; } FxViewItem *topItem = snapItemAt(tempPosition+highlightRangeStart); - if (strictHighlightRange && currentItem) { + if (strictHighlightRange && currentItem && (!topItem || topItem->index != currentIndex)) { // StrictlyEnforceRange always keeps an item in range updateHighlight(); topItem = currentItem; } FxViewItem *bottomItem = snapItemAt(tempPosition+highlightRangeEnd); - if (strictHighlightRange && currentItem) { + if (strictHighlightRange && currentItem && (!bottomItem || bottomItem->index != currentIndex)) { // StrictlyEnforceRange always keeps an item in range updateHighlight(); bottomItem = currentItem; -- cgit v1.2.3