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.

Voted #1 for:

  • Easiest to learn
  • Most time saving
  • Best support

Develop Cross-Platform Apps and Games 50% Faster!

  • Voted the best supported, most time-saving and easiest to learn cross-platform development tool
  • Based on the Qt framework, with native performance and appearance on all platforms including iOS and Android
  • Offers a variety of plugins to monetize, analyze and engage users
FREE!
create apps
create games
cross platform
native performance
3rd party services
game network
multiplayer
level editor
easiest to learn
biggest time saving
best support