SwipeView, how to restrict the user in swiping to advance to the next page?
-
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?
-
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. WrapStackView
withMouseArea
and do some maths. -
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?
@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