diff options
author | Martin Jones <[email protected]> | 2012-06-27 15:29:54 +1000 |
---|---|---|
committer | Qt by Nokia <[email protected]> | 2012-06-27 08:49:46 +0200 |
commit | 589d39ec6c35edc1ba195474be30dfcf8c31598d (patch) | |
tree | 733e9a8d6cad13a01fcd37437a2f89d2e33ca90b /src/quick/items/qquickpathview.cpp | |
parent | 630a481854f9dae38b48e1e5e83435746f38c5ae (diff) |
PathView element with 1 item moves in wrong direction when dragged right
The shortest direction calculation used integer math to determine
which direction to move. For an odd modelCount, the wrong direction
could be chosen. For a modelCount of 1 it was particularly obvious.
Task-number: QTBUG-21337
Change-Id: I5e75c74153a5b4c62d1536226cd0703dcae04178
Reviewed-by: Andrew den Exter <[email protected]>
Diffstat (limited to 'src/quick/items/qquickpathview.cpp')
-rw-r--r-- | src/quick/items/qquickpathview.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/quick/items/qquickpathview.cpp b/src/quick/items/qquickpathview.cpp index e96e98856a..33c5b8c9ed 100644 --- a/src/quick/items/qquickpathview.cpp +++ b/src/quick/items/qquickpathview.cpp @@ -1926,7 +1926,7 @@ void QQuickPathViewPrivate::snapToIndex(int index) if (!duration) { tl.set(moveOffset, targetOffset); - } else if (moveDirection == Positive || (moveDirection == Shortest && targetOffset - offset > modelCount/2)) { + } else if (moveDirection == Positive || (moveDirection == Shortest && targetOffset - offset > modelCount/2.0)) { qreal distance = modelCount - targetOffset + offset; if (targetOffset > moveOffset) { tl.move(moveOffset, 0.0, QEasingCurve(QEasingCurve::InQuad), int(duration * offset / distance)); @@ -1935,7 +1935,7 @@ void QQuickPathViewPrivate::snapToIndex(int index) } else { tl.move(moveOffset, targetOffset, QEasingCurve(QEasingCurve::InOutQuad), duration); } - } else if (moveDirection == Negative || targetOffset - offset <= -modelCount/2) { + } else if (moveDirection == Negative || targetOffset - offset <= -modelCount/2.0) { qreal distance = modelCount - offset + targetOffset; if (targetOffset < moveOffset) { tl.move(moveOffset, modelCount, QEasingCurve(targetOffset == 0 ? QEasingCurve::InOutQuad : QEasingCurve::InQuad), int(duration * (modelCount-offset) / distance)); |