aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items
diff options
context:
space:
mode:
authorAlberto Mardegan <alberto.mardegan@canonical.com>2015-11-10 15:42:23 +0200
committerAlberto Mardegan <mardy@users.sourceforge.net>2015-11-13 07:25:02 +0000
commit2b779fbd25aaf09897ee2cdc4edffd12a980420b (patch)
treeb3d5664e2e2303acb13cdcb900161edd75e6ead6 /src/quick/items
parent4ff385e8cd509ab735e3dc5149273fe75d2de105 (diff)
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 <albert.astals@canonical.com> Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
Diffstat (limited to 'src/quick/items')
-rw-r--r--src/quick/items/qquickgridview.cpp4
-rw-r--r--src/quick/items/qquicklistview.cpp4
2 files changed, 4 insertions, 4 deletions
diff --git a/src/quick/items/qquickgridview.cpp b/src/quick/items/qquickgridview.cpp
index 3ac9c6eb1c..65d7362e84 100644
--- a/src/quick/items/qquickgridview.cpp
+++ b/src/quick/items/qquickgridview.cpp
@@ -922,13 +922,13 @@ void QQuickGridViewPrivate::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;
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;