Find the Best Demos and Examples

Check out this quick tour to find the best demos and examples for you, and to see how the Felgo SDK can help you to develop your next app or game!

Forums

OverviewFelgo 2 Support (Qt 5) › Pop all pages in NavigationStack included in a NavigationItem

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #18370

    Javier

    Hello,

    How can I pop all pages in NavigationStack included in a NavigationItem when the current navigation index changes?. The idea is to go to the initial page in the NavigationStack when the user changes the Navigation page and the go back to the previous one.

    Thanks.

    #18373

    Alex
    Felgo Team

    Hi Javier,

    there are several ways to do this, let me just quickly highlight what you could have a look at:

    Navigation –> has currentIndex and currentNavigationItem, you can listen to the changed signal to check if the current NavigationItem changed

    NavigationItem –> has a selected() signal that you could also be used to check if your desired NavigationItem got active

    NavigationStack –> has popAllExceptFirst() method to go back to initial page

    Cheers,
    Alex

    #18375

    Javier

    Thanks Alex. The issue is that I cannot get access to the NavigationStack id since it inherits from Loader. I do not know how to overcome this.

    Navigation {
      id: nav
    
      // Item
      NavigationItem {
        id: navItem          
        onSelected: navItemStck.popAllExceptFirst() // ReferenceError
    
        NavigationStack {
          id: navItemStck
        }
      }
    }

     

    #18376

    Alex
    Felgo Team

    Hi,

    the NavigationItem has a property navigationStack, that holds a reference to the contained NavigationStack item, you can just use

    onSelected: navItem.navigationStack.popAllExceptFirst()

    Cheers,
    Alex

    #18383

    Javier

    Ahhh, thanks!. I think a have to read again the documentation :-).

    #18384

    Alex
    Felgo Team

    Alright Javier, written exam tomorrow, be prepared! 🙂

Viewing 6 posts - 1 through 6 (of 6 total)

RSS feed for this thread

You must be logged in to reply to this topic.