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) › Move to pages by button clicks

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #18518

    Wojciech

    I have a main item with Navigation object, that has four pages. Changing pages by navigation menu works OK.

    On the first page, which is my “application cockpit”, I have some additional buttons for navigating: I want to use these buttons to move to most important pages from navigation menu. How I could do that? Is navigation object visibile globally?

    #18523

    Alex
    Felgo Team

    Hi

    I hope I understand the question correctly, are you looking for something like this:

    import Felgo 3.0
    import QtQuick 2.5
    
    App {
    id: app
    
      Navigation {
        id: navigation
        NavigationItem {
          title: "First"
          icon: IconType.heart
          NavigationStack {
            Page {
              title: "First Page"
              
              AppButton {
                anchors.centerIn: parent
                text: "Open Second Page"
                onClicked: {
                  navigation.currentIndex = 1
                }
              }
            }
          }
        }
        
        NavigationItem {
          title: "Second"
          icon: IconType.heart
          NavigationStack {
            Page {
              title: "Second Page"
              AppButton {
                anchors.centerIn: parent
                text: "Open First Page"
                onClicked: {
                  navigation.currentIndex = 0
                }
              }
            }
          }
        }
      }
    }

    I am changing the active navigation item by changing the currentIndex of the navigation with my buttons.

    Cheers,
    Alex

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

RSS feed for this thread

You must be logged in to reply to this topic.