summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-02-12 21:24:01 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-02-12 21:24:01 (GMT)
commitd1652b725084acf360aca945cfe37b712b49ea7e (patch)
treeb42f774deba4830ddca5e2e7d91aceff2b247a58
parent7263810f4802a3a6755193f6f2692436600a5e53 (diff)
parent749f11d49306b0ee9e3258117b5753d6c4a43d6b (diff)
downloadQt-d1652b725084acf360aca945cfe37b712b49ea7e.zip
Qt-d1652b725084acf360aca945cfe37b712b49ea7e.tar.gz
Qt-d1652b725084acf360aca945cfe37b712b49ea7e.tar.bz2
Merge branch 'master' of scm.dev.nokia.troll.no:qt/qt-qml into master-integration
* 'master' of scm.dev.nokia.troll.no:qt/qt-qml: Fix scrolling backwards when pathItemCount != model.count
-rw-r--r--src/declarative/graphicsitems/qmlgraphicspathview.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/declarative/graphicsitems/qmlgraphicspathview.cpp b/src/declarative/graphicsitems/qmlgraphicspathview.cpp
index 85e87eb..6718d25 100644
--- a/src/declarative/graphicsitems/qmlgraphicspathview.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicspathview.cpp
@@ -910,11 +910,16 @@ void QmlGraphicsPathViewPrivate::snapToCurrent()
//Rounds is the number of times round to make the current item visible
int rounds = itemIndex / items.count();
- int otherWayRounds = (model->count() - (itemIndex)) / items.count() + 1;
+ int otherWayRounds = (model->count() - (itemIndex)) / items.count();
if (otherWayRounds < rounds)
rounds = -otherWayRounds;
itemIndex += pathOffset;
+ if(model->count() % items.count() && itemIndex - model->count() + items.count() > 0){
+ //When model.count() is not a multiple of pathItemCount we need to manually
+ //fix the index so that going backwards one step works correctly.
+ itemIndex = itemIndex - model->count() + items.count();
+ }
itemIndex %= items.count();
qreal targetOffset = qmlMod(100 + (snapPos*100) - 100.0 * itemIndex / items.count(), qreal(100.0));
@@ -928,7 +933,7 @@ void QmlGraphicsPathViewPrivate::snapToCurrent()
moveOffset.setValue(_offset);
if (rounds!=0){
- //Compensate if the targetOffset would bring the target it from off the screen
+ //Compensate if the targetOffset would bring the target in from off the screen
qreal distance = targetOffset - _offset;
if (distance <= -50)
rounds--;