Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. ListView/SwipeView and Jumping between elements
Qt 6.11 is out! See what's new in the release blog

ListView/SwipeView and Jumping between elements

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
3 Posts 2 Posters 1.8k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Chetana K M
    wrote on last edited by
    #1

    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 ?
    1 Reply Last reply
    0
    • YashpalY Offline
      YashpalY Offline
      Yashpal
      wrote on last edited by
      #2

      @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.

      C 1 Reply Last reply
      0
      • YashpalY Yashpal

        @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.

        C Offline
        C Offline
        Chetana K M
        wrote on last edited by
        #3

        @Yashpal Thanks :-) Its working fine.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt
        • Unsolved