ListView/SwipeView and Jumping between elements



  • Hi

    1. I have created listView and assigned to Model with five elements.
    2. I have set horizontal flick
    3. In the display only one elelement in model is visible.
    4. Each of the elements in ListView I call it as page.
    //your code here
    ```Rectangle {
    width : 400;height : 400
    Component {id : del Rectangle {width : 400: height : 400;color : col}
    ListView {
        anchors.fill : parent
        delegate : del
        model : mod
    }
    }
    
    Delegate size is same as Rectangle. Now only one element in model is visible. when I flick in horizontal direction it works perfectly. Essentially I'm ensuring kind of swipeview using listView. It is list of pages. Each page is shown one-by-one.
    
    Now, I would like jump between the pages. e.g I would like set the currentIndex =3 from 0. I would like to view to jump directly to 3rd page.
    
    Issue - When I change the index randomly from 0 to 3, it goes to 0-1, 1-2, 2-3. So each page is between 0 to 3 is shown. 
    
    What I need is jump directly to 3rd page from first page without showing the 2nd page.
    
    Any idea how to achieve this ?


  • @Chetana-K-M said in ListView/SwipeView and Jumping between elements:

    Now, I would like jump between the pages. e.g I would like set the currentIndex =3 from 0. I would like to view to jump directly to 3rd page.

    Issue - When I change the index randomly from 0 to 3, it goes to 0-1, 1-2, 2-3. So each page is between 0 to 3 is shown.

    What I need is jump directly to 3rd page from first page without showing the 2nd page.

    You can set highlightMoveDuration: 0 for your ListView. Hope, this answers your question.



  • @Yashpal Thanks :-) Its working fine.


Log in to reply
 

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