summaryrefslogtreecommitdiffstats
path: root/src/declarative
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2011-09-14 06:24:30 (GMT)
committerMartin Jones <martin.jones@nokia.com>2011-09-14 06:24:30 (GMT)
commit09cd2f818208a83489fae034b80e6497b7cc83af (patch)
tree8caa25cd7ca5d154ef910018543e8c5b4620fd51 /src/declarative
parent7d0e1bb75dcb8d6d4fa843f95610fd1adec803f0 (diff)
downloadQt-09cd2f818208a83489fae034b80e6497b7cc83af.zip
Qt-09cd2f818208a83489fae034b80e6497b7cc83af.tar.gz
Qt-09cd2f818208a83489fae034b80e6497b7cc83af.tar.bz2
Fix StrictlyEnforceRange with snapOneItem/Row and header behavior, pt 2
Change cf23188de237009136fa1480ab8fd9e3ca364769 changed the positioning of a view with StrictlyEnforceRange, snapOneItem/Row, and a header, such that the view was positioned at the beginning of the header, rather than on the first item. Change f85819fe083ae7c6804c884de68e906d153a6d11 partially fixed the problem. This change handles the case of the header/footer being large enough to cause a snap item not to be found when the view is dragged beyond the first/last item. In this case snap to the currentItem. Change-Id: I08b7e61496a79f71c3b40fafaca985ae90f88503 Task-number: QTTH-1501 Reviewed-by: Bea Lam
Diffstat (limited to 'src/declarative')
-rw-r--r--src/declarative/graphicsitems/qdeclarativegridview.cpp10
-rw-r--r--src/declarative/graphicsitems/qdeclarativelistview.cpp12
2 files changed, 21 insertions, 1 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp
index 5a5b60e..ff88e31 100644
--- a/src/declarative/graphicsitems/qdeclarativegridview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp
@@ -1081,7 +1081,17 @@ void QDeclarativeGridViewPrivate::fixup(AxisData &data, qreal minExtent, qreal m
tempPosition -= bias;
}
FxGridItem *topItem = snapItemAt(tempPosition+highlightStart);
+ if (!topItem && strictHighlightRange && currentItem) {
+ // StrictlyEnforceRange always keeps an item in range
+ updateHighlight();
+ topItem = currentItem;
+ }
FxGridItem *bottomItem = snapItemAt(tempPosition+highlightEnd);
+ if (!bottomItem && strictHighlightRange && currentItem) {
+ // StrictlyEnforceRange always keeps an item in range
+ updateHighlight();
+ bottomItem = currentItem;
+ }
qreal pos;
if (topItem && bottomItem && strictHighlightRange) {
qreal topPos = qMin(topItem->rowPos() - highlightStart, -maxExtent);
diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp
index 70be7a7..6c8e99b 100644
--- a/src/declarative/graphicsitems/qdeclarativelistview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp
@@ -1324,10 +1324,20 @@ void QDeclarativeListViewPrivate::fixup(AxisData &data, qreal minExtent, qreal m
tempPosition -= bias;
}
FxListItem *topItem = snapItemAt(tempPosition+highlightStart);
+ if (!topItem && strictHighlightRange && currentItem) {
+ // StrictlyEnforceRange always keeps an item in range
+ updateHighlight();
+ topItem = currentItem;
+ }
FxListItem *bottomItem = snapItemAt(tempPosition+highlightEnd);
+ if (!bottomItem && strictHighlightRange && currentItem) {
+ // StrictlyEnforceRange always keeps an item in range
+ updateHighlight();
+ bottomItem = currentItem;
+ }
qreal pos;
bool isInBounds = -position() > maxExtent && -position() <= minExtent;
- if (topItem && isInBounds) {
+ if (topItem && (isInBounds || strictHighlightRange)) {
if (topItem->index == 0 && header && tempPosition+highlightStart < header->position()+header->size()/2 && !strictHighlightRange) {
pos = isRightToLeft() ? - header->position() + highlightStart - size() : header->position() - highlightStart;
} else {