From 7062c0e2d273ed32a7fd33d5320e811ef72e6682 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Wed, 27 Jul 2011 10:08:58 +1000 Subject: [PATCH] View highlight flickers with highlightRangeMode: ApplyRange The view position was alternating between the start and end of the highlight range if the range < delegate size. Now favor the range start in this case, as per StrictlyEnforceRange. Change-Id: Icb895f972ccb9598ecf7238259093584c43ae291 Fixes: QTBUG-18067 Reviewed-on: http://codereview.qt.nokia.com/2226 Reviewed-by: Qt Sanity Bot Reviewed-by: Martin Jones --- src/declarative/items/qsgitemview.cpp | 7 +++---- .../graphicsitems/qdeclarativegridview.cpp | 7 +++---- .../graphicsitems/qdeclarativelistview.cpp | 7 +++---- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/declarative/items/qsgitemview.cpp b/src/declarative/items/qsgitemview.cpp index a9550e8..0198d58 100644 --- a/src/declarative/items/qsgitemview.cpp +++ b/src/declarative/items/qsgitemview.cpp @@ -753,11 +753,10 @@ void QSGItemView::trackedPositionChanged() if (pos < d->startPosition()) pos = d->startPosition(); } else { - if (trackedPos < viewPos + highlightStart) { - pos = trackedPos - highlightStart; - } else if (trackedPos > viewPos + highlightEnd - trackedSize) { + if (trackedPos > pos + highlightEnd - trackedSize) pos = trackedPos - highlightEnd + trackedSize; - } + if (trackedPos < pos + highlightStart) + pos = trackedPos - highlightStart; } } } else { diff --git a/src/qtquick1/graphicsitems/qdeclarativegridview.cpp b/src/qtquick1/graphicsitems/qdeclarativegridview.cpp index ff54b13..f81256c 100644 --- a/src/qtquick1/graphicsitems/qdeclarativegridview.cpp +++ b/src/qtquick1/graphicsitems/qdeclarativegridview.cpp @@ -2714,11 +2714,10 @@ void QDeclarative1GridView::trackedPositionChanged() if (pos < d->startPosition()) pos = d->startPosition(); } else { - if (trackedPos < viewPos + highlightStart) { - pos = trackedPos - highlightStart; - } else if (trackedPos > viewPos + highlightEnd - d->rowSize()) { + if (trackedPos > pos + highlightEnd - d->rowSize()) pos = trackedPos - highlightEnd + d->rowSize(); - } + if (trackedPos < pos + highlightStart) + pos = trackedPos - highlightStart; } } } else { diff --git a/src/qtquick1/graphicsitems/qdeclarativelistview.cpp b/src/qtquick1/graphicsitems/qdeclarativelistview.cpp index 1e6a4a0..8fafdbe 100644 --- a/src/qtquick1/graphicsitems/qdeclarativelistview.cpp +++ b/src/qtquick1/graphicsitems/qdeclarativelistview.cpp @@ -3162,11 +3162,10 @@ void QDeclarative1ListView::trackedPositionChanged() if (pos < d->startPosition()) pos = d->startPosition(); } else { - if (trackedPos < viewPos + highlightStart) { - pos = trackedPos - highlightStart; - } else if (trackedPos > viewPos + highlightEnd - trackedSize) { + if (trackedPos > pos + highlightEnd - trackedSize) pos = trackedPos - highlightEnd + trackedSize; - } + if (trackedPos < pos + highlightStart) + pos = trackedPos - highlightStart; } } } else { -- 1.7.2.5