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, how to restrict the user in swiping to advance to the next page?
Forum Updated to NodeBB v4.3 + New Features

SwipeView, how to restrict the user in swiping to advance to the next page?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
3 Posts 3 Posters 282 Views 1 Watching
  • 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.
  • SandebsS Offline
    SandebsS Offline
    Sandebs
    wrote on last edited by
    #1

    Hi, I have the following problem. I have a set of pages in a Swipeview. A user is to input some data on each page. I want the user to be restricted to only be able to advance to the next page when there is some valid input on the current page. I.e. the user can swipe to advance to the next page if there is some valid input (in a text input box, or a radio button is checked etc.), but the user cannot swipe forwards if there is no input or the input is invalid. However, the user should always be able to return to the previous page by swiping backwards.

    My current solution uses the interactive property of swipeview, and sets this property to true or false based on the input on the page. This solution restricts the user in advancing to the next page, but the user is also unable to swipe backwards, so it is not an optimal solution.

    Does anyone here have a similar problem or a solution to such a problem?

    J.HilkJ 1 Reply Last reply
    0
    • IntruderExcluderI Offline
      IntruderExcluderI Offline
      IntruderExcluder
      wrote on last edited by
      #2

      Probably you need to use StackView instead. But, unfortunately, there is no way to detect swipe that easy, you may to need implement it by yourself. Wrap StackView with MouseArea and do some maths.

      1 Reply Last reply
      1
      • SandebsS Sandebs

        Hi, I have the following problem. I have a set of pages in a Swipeview. A user is to input some data on each page. I want the user to be restricted to only be able to advance to the next page when there is some valid input on the current page. I.e. the user can swipe to advance to the next page if there is some valid input (in a text input box, or a radio button is checked etc.), but the user cannot swipe forwards if there is no input or the input is invalid. However, the user should always be able to return to the previous page by swiping backwards.

        My current solution uses the interactive property of swipeview, and sets this property to true or false based on the input on the page. This solution restricts the user in advancing to the next page, but the user is also unable to swipe backwards, so it is not an optimal solution.

        Does anyone here have a similar problem or a solution to such a problem?

        J.HilkJ Online
        J.HilkJ Online
        J.Hilk
        Moderators
        wrote on last edited by
        #3

        @Sandebs the probably easiest solution would be to work with different models and/or with a proper c++ model that changes depending on selections your user makes.

        maybe you'll have to restore the currentIndex after the modelChanged signal is emitted. But I'm unsure about that


        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
        0

        • Login

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