View highlight flickers with highlightRangeMode: ApplyRange
authorMartin Jones <martin.jones@nokia.com>
Wed, 27 Jul 2011 00:08:58 +0000 (10:08 +1000)
committerQt by Nokia <qt-info@nokia.com>
Thu, 28 Jul 2011 03:04:24 +0000 (05:04 +0200)
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 <qt_sanity_bot@ovi.com>
Reviewed-by: Martin Jones <martin.jones@nokia.com>
src/declarative/items/qsgitemview.cpp
src/qtquick1/graphicsitems/qdeclarativegridview.cpp
src/qtquick1/graphicsitems/qdeclarativelistview.cpp

index a9550e8..0198d58 100644 (file)
@@ -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 {
index ff54b13..f81256c 100644 (file)
@@ -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 {
index 1e6a4a0..8fafdbe 100644 (file)
@@ -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 {