diff options
| author | Martin Jones <martin.jones@nokia.com> | 2010-02-16 01:32:35 (GMT) |
|---|---|---|
| committer | Martin Jones <martin.jones@nokia.com> | 2010-02-16 01:32:35 (GMT) |
| commit | 6f3649260d157584361112a94733b92f10c01b84 (patch) | |
| tree | 13197132bd1f3854572728ff1699fa6780021365 /src/declarative/graphicsitems/qmlgraphicspathview.cpp | |
| parent | b77e592cf9709c31f61c3e1d229b2a6c446ab8bc (diff) | |
| parent | e7041de4d51a3166948924fc8640c8c6bc8daa7b (diff) | |
| download | Qt-6f3649260d157584361112a94733b92f10c01b84.zip Qt-6f3649260d157584361112a94733b92f10c01b84.tar.gz Qt-6f3649260d157584361112a94733b92f10c01b84.tar.bz2 | |
Merge branch 'master' of scm.dev.nokia.troll.no:qt/qt-qml
Diffstat (limited to 'src/declarative/graphicsitems/qmlgraphicspathview.cpp')
| -rw-r--r-- | src/declarative/graphicsitems/qmlgraphicspathview.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/declarative/graphicsitems/qmlgraphicspathview.cpp b/src/declarative/graphicsitems/qmlgraphicspathview.cpp index 85e87eb..a1c9229 100644 --- a/src/declarative/graphicsitems/qmlgraphicspathview.cpp +++ b/src/declarative/graphicsitems/qmlgraphicspathview.cpp @@ -54,9 +54,6 @@ QT_BEGIN_NAMESPACE -QML_DEFINE_TYPE(Qt,4,6,PathView,QmlGraphicsPathView) - - inline qreal qmlMod(qreal x, qreal y) { #ifdef QT_USE_MATH_H_FLOATS @@ -910,11 +907,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 +930,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--; |
