Page Navigation



  • Hi

    In my app I have only a few main pages.
    I implemented SwipeView and it's OK, but I can't swipe directly from page 1 to 3, it goes through page 2.
    So, I have switched to StackView, but then when I'm switching through the pages I need to check whether page I want to show is already in stack, if so unwind to this page, if not push page to stack. I ended up with having one page in the stack and calling replace each time I want to show some page.
    I mean what for is this stack if I can't setCurrentIndex ;) I'm just switching from QWidgets to QML so maybe I'm getting something wrong?

    Best Regards
    Marek



  • @Marek StackLayout lets you set the current index. StackView is good for a real stack with pop/push operations if you need them, StackLayout is a simple way to show one item at a time out of several.



  • @Eeli-K Thanks, it is some solution, although it does not have transitions. Someone has done github example with StackLayout and transitions but... still probably StackView is a way to go.
    Thanks anyway ;)
    Marek


  • Qt Champions 2016

    @Marek go to Google Play or Apple APP Store, search for 'Ekkehard Gentz' and you'll find some apps (per ex Qt World Summit 2016 or my brandnew BT LE example).
    These Apps all use StackViews:
    one StackView at root used by the Drawer, where for each Item in Drawer the Item get's replaced by a Page oder another StackView.
    Then you can navigate thru the Stack (pushing Pages on top, pop Page or go back to another one
    Apps are Open Source at GitHUb

    Also there are examples by me explaining all of this:
    StackView: https://appbus.wordpress.com/2016/05/27/stacked-pages-app/
    Drawer: https://appbus.wordpress.com/2016/06/20/drawer-navigation-app/

    have fun




Log in to reply
 

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