diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-02-13 04:06:09 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-02-13 04:06:09 (GMT) |
commit | 40e277aa622e74c18fb1b16214a2c1fe40870315 (patch) | |
tree | 60df855536a275770e48198c9f8672eadca8f63f /src | |
parent | cc278c905839cd7dc4469dee3264fa80a622494e (diff) | |
parent | d1652b725084acf360aca945cfe37b712b49ea7e (diff) | |
download | Qt-40e277aa622e74c18fb1b16214a2c1fe40870315.zip Qt-40e277aa622e74c18fb1b16214a2c1fe40870315.tar.gz Qt-40e277aa622e74c18fb1b16214a2c1fe40870315.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
Diffstat (limited to 'src')
-rw-r--r-- | src/declarative/graphicsitems/qmlgraphicspathview.cpp | 9 |
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--; |