Implementing swipe to refresh as in material design



  • Hi,

    I want to implement an swipe-to-refresh behavior as described in the material design here: https://www.google.com/design/spec/patterns/swipe-to-refresh.html

    Now there is the twitter search example. It works by using the contentY property to see how much the list is overshoot.

     states: [
            State {
                name: "base"; when: mainListView.contentY >= -120
                PropertyChanges { target: arrow; rotation: 180 }
            },
            State {
                name: "pulled"; when: mainListView.contentY < -120
                PropertyChanges { target: label; text: "Release to refresh..." }
                PropertyChanges { target: arrow; rotation: 0 }
            }
        ]
    

    That is nice, but not what I want. I want my list not to overhoot. But when setting:

            boundsBehavior: Flickable.StopAtBounds
    

    The contentY "trick" does not work anymore.

    So I wonder how can I set the boundsBehavior to StopAtBounds but still react to overshooting?

    Or how else can I implement swipe-to-refresh as described in the material design?

    Thanks!
    Nathan



  • Has someone implemented something like this or is there maybe already something directly in Qt? I already searched the Qt documentation but couldn't find anything. But maybe I am using the wrong search keywords.


  • Moderators

    @Schluchti AFAIK this functionality is no yet implemented in Qt so you are left with creating your own. Here is one that I came across. Ofcourse it is for BB but you can subsitute similar existing components provided by Qt with some extra coding :)


Log in to reply
 

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