[Solved] ListView: Modify the animation/rebound behaviour of snap mode


  • Qt Champions 2016

    Hi all,

    I would like to create a component which will display one item at a time. User may do a swipe gesture to scroll to next item. However, I don't like the default easing curve used in the snap animation of ListView. I prefer a linear curve which will not rebound / or just rebound slightly. Any method to modify this behaviour?

    I have tried to set the rebound transition but it don't work. Thanks for any advise.

    The code:

    @
    import QtQuick 2.0

    ListView {
    orientation: ListView.Horizontal
    snapMode: ListView.SnapOneItem
    highlightRangeMode: ListView.StrictlyEnforceRange
    rebound: Transition {
    NumberAnimation {
    properties: "x,y"
    duration: 1000
    easing.type: Easing.Linear
    }
    }
    }
    @



  • Try
    @
    boundsBehavior: Flickable.StopAtBounds
    @


  • Qt Champions 2016

    It works! Thank you!


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.