Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. SwipeView reaching the end of the list

SwipeView reaching the end of the list

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
swipeview
2 Posts 2 Posters 802 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.
  • B Offline
    B Offline
    Blutimauge
    wrote on 24 Apr 2019, 09:27 last edited by
    #1

    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

    J 1 Reply Last reply 24 Apr 2019, 09:48
    0
    • B Blutimauge
      24 Apr 2019, 09:27

      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

      J Online
      J Online
      J.Hilk
      Moderators
      wrote on 24 Apr 2019, 09:48 last edited by
      #2

      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


      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


      Q: What's that?
      A: It's blue light.
      Q: What does it do?
      A: It turns blue.

      1 Reply Last reply
      3

      2/2

      24 Apr 2019, 09:48

      • Login

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