summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2011-09-12 03:07:58 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2011-09-12 03:07:58 (GMT)
commit502c4d7e000e6accf4f86b28459a83c7c7763057 (patch)
tree81b4c0452f70ae64357f5270d8ea98061e816d5a
parent4a4909f59b58a02ff405095b99df8f28d1f6cfed (diff)
parentf85819fe083ae7c6804c884de68e906d153a6d11 (diff)
downloadQt-502c4d7e000e6accf4f86b28459a83c7c7763057.zip
Qt-502c4d7e000e6accf4f86b28459a83c7c7763057.tar.gz
Qt-502c4d7e000e6accf4f86b28459a83c7c7763057.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-qml: StrictlyEnforceRange with snapOneItem/Row and header behavior change
-rw-r--r--src/declarative/graphicsitems/qdeclarativegridview.cpp6
-rw-r--r--src/declarative/graphicsitems/qdeclarativelistview.cpp7
2 files changed, 8 insertions, 5 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp
index 20410ab..92b85f9 100644
--- a/src/declarative/graphicsitems/qdeclarativegridview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp
@@ -1064,6 +1064,8 @@ void QDeclarativeGridViewPrivate::fixup(AxisData &data, qreal minExtent, qreal m
highlightEnd = highlightRangeEnd;
}
+ bool strictHighlightRange = haveHighlightRange && highlightRange == QDeclarativeGridView::StrictlyEnforceRange;
+
if (snapMode != QDeclarativeGridView::NoSnap) {
qreal tempPosition = isRightToLeftTopToBottom() ? -position()-size() : position();
if (snapMode == QDeclarativeGridView::SnapOneRow && moveReason == Mouse) {
@@ -1081,7 +1083,7 @@ void QDeclarativeGridViewPrivate::fixup(AxisData &data, qreal minExtent, qreal m
FxGridItem *topItem = snapItemAt(tempPosition+highlightStart);
FxGridItem *bottomItem = snapItemAt(tempPosition+highlightEnd);
qreal pos;
- if (topItem && bottomItem && haveHighlightRange && highlightRange == QDeclarativeGridView::StrictlyEnforceRange) {
+ if (topItem && bottomItem && strictHighlightRange) {
qreal topPos = qMin(topItem->rowPos() - highlightStart, -maxExtent);
qreal bottomPos = qMax(bottomItem->rowPos() - highlightEnd, -minExtent);
pos = qAbs(data.move + topPos) < qAbs(data.move + bottomPos) ? topPos : bottomPos;
@@ -1089,7 +1091,7 @@ void QDeclarativeGridViewPrivate::fixup(AxisData &data, qreal minExtent, qreal m
qreal headerPos = 0;
if (header)
headerPos = isRightToLeftTopToBottom() ? header->rowPos() + cellWidth - headerSize() : header->rowPos();
- if (topItem->index == 0 && header && tempPosition+highlightStart < headerPos+headerSize()/2) {
+ if (topItem->index == 0 && header && tempPosition+highlightStart < headerPos+headerSize()/2 && !strictHighlightRange) {
pos = isRightToLeftTopToBottom() ? - headerPos + highlightStart - size() : headerPos - highlightStart;
} else {
if (isRightToLeftTopToBottom())
diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp
index e75189c..b34dc43 100644
--- a/src/declarative/graphicsitems/qdeclarativelistview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp
@@ -1293,6 +1293,7 @@ void QDeclarativeListViewPrivate::fixup(AxisData &data, qreal minExtent, qreal m
correctFlick = false;
fixupMode = moveReason == Mouse ? fixupMode : Immediate;
+ bool strictHighlightRange = haveHighlightRange && highlightRange == QDeclarativeListView::StrictlyEnforceRange;
qreal highlightStart;
qreal highlightEnd;
@@ -1325,9 +1326,9 @@ void QDeclarativeListViewPrivate::fixup(AxisData &data, qreal minExtent, qreal m
FxListItem *topItem = snapItemAt(tempPosition+highlightStart);
FxListItem *bottomItem = snapItemAt(tempPosition+highlightEnd);
qreal pos;
- bool isInBounds = -position() > maxExtent && -position() < minExtent;
+ bool isInBounds = -position() > maxExtent && -position() <= minExtent;
if (topItem && isInBounds) {
- if (topItem->index == 0 && header && tempPosition+highlightStart < header->position()+header->size()/2) {
+ if (topItem->index == 0 && header && tempPosition+highlightStart < header->position()+header->size()/2 && !strictHighlightRange) {
pos = isRightToLeft() ? - header->position() + highlightStart - size() : header->position() - highlightStart;
} else {
if (isRightToLeft())
@@ -1356,7 +1357,7 @@ void QDeclarativeListViewPrivate::fixup(AxisData &data, qreal minExtent, qreal m
}
vTime = timeline.time();
}
- } else if (currentItem && haveHighlightRange && highlightRange == QDeclarativeListView::StrictlyEnforceRange
+ } else if (currentItem && strictHighlightRange
&& moveReason != QDeclarativeListViewPrivate::SetIndex) {
updateHighlight();
qreal pos = currentItem->itemPosition();