diff options
author | Andras Becsi <andras.becsi@theqtcompany.com> | 2015-07-06 17:27:47 +0200 |
---|---|---|
committer | Andras Becsi <andras.becsi@theqtcompany.com> | 2015-08-12 17:22:01 +0200 |
commit | f2837a6a6cd2a673dc5ab0acbdf50b55496449e8 (patch) | |
tree | ce562710c4d5be43354bec1f187d901d3643e182 | |
parent | 13730318d4261fbc9f3225a27e38578e61b75583 (diff) |
Change visible items to 5
-rw-r--r-- | src/qml/PageView.qml | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/qml/PageView.qml b/src/qml/PageView.qml index ec1b205..d20d06f 100644 --- a/src/qml/PageView.qml +++ b/src/qml/PageView.qml @@ -332,6 +332,7 @@ Rectangle { onClicked: { var pos = pathView.mapFromItem(wrapper, mouse.x, mouse.y) var index = pathView.indexAt(pos.x, pos.y) + var distance = Math.abs(pathView.currentIndex - index) if (index < 0) return @@ -352,13 +353,17 @@ Rectangle { return } + if (distance > 1) { + pathView.positionViewAtIndex(index, PathView.SnapPosition) + } + if (pathView.currentIndex > index) { - pathView.decrementCurrentIndex() + pathView.decrementCurrentIndex() return } if (pathView.currentIndex < index) { - pathView.incrementCurrentIndex() + pathView.incrementCurrentIndex() return } } @@ -371,7 +376,7 @@ Rectangle { PathView { id: pathView - pathItemCount: 3 + pathItemCount: 5 anchors.fill: parent model: listModel delegate: delegate |