SwipeView reaching the end of the list
-
Hello everyone,
I got a QML SwipeView inside a StackView: each element of the swipeView is a clickable image that pushes a new page onto the stack.
SwipeView { id: workflowSwipe currentIndex: 0 ItemDelegate { id: firstDelegate Image { ... } onClicked: { stackView.push(); } } ItemDelegate { id: secondDelegate Image { ... } onClicked: { stackView.push(); } } }
The SwipeView works as expected when swiping right or left, until I reach the end of the list, when a subsequent swipe on the right/left is not catched as a swipe (since the list is over) but as a click, making the onClicked signal trigger and moving onto the pushed page. This shouldn't happen, i want the view to understand that i swiped and reached the end of the list.
To solve this problem I thought about creating an infinite circular list that returns to the first item when the last is reached, or allow the SwipeView to understand that it reaches the end of the list and catches the swipe as a real swipe that "bumps" the list to show that there are no more elements.
In both cases I didn't find on the documentation a way to intercept the swipe movement and/or a way to force the list to circle indefinitely.
Are there any way to achieve what i want to do or am I following the wrong path from the beginning?
Thanks
-
Hi @Blutimauge
and welcome.I think SwipeView may be the wrong component for your use case.
I would suggest looking into Flickable or the derived forms ListView/GridView.They handle end bouncing and continuous flow much better, as in it's build in. IIRC