Learn what Felgo offers to help your business succeed. Start your free evaluation today! Felgo for Your Business

Forums

OverviewFelgo 3 Support (Qt 5) › Disable specific page .pop() on android back button

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #22340

    Edward

    Hello!

    The first page in my navigation stack is my login page, which then pushes to my homepage.

    I have added a ‘log out’ button to the page, but when users press the back button on android or the navigation.backButton on either platform it logs them out;

    Can I disable these features so that the only way my users can log out is through using the dedicated ‘log out’ button I created?

    Where the homepage is not the first page is my stack I need to be able to target this behaviour to just this page!

     

    Thanks

    Edd

    #22349

    Janne

    If I understood your problem correctly, you could try something like this:

    Page {
    
        onAppeared: mainView.forceActiveFocus()
    
        FocusScope {
            id: mainView
            focus: true
    
            Keys.onBackPressed: {
                // This will grab the back button press
            }
    
    ...
    

    br

    Janne

     

    #22350

    Edward

    Thanks for the response! I’ll test it out tonight and see! Removing the logout signal calls still allowed the page to pop but kept me logged in so efdectiveoy locked me out under ‘already authenticated’

    #22391

    Edward

    Hello Janne!

     

    Thanks again for the help, where I am removing the ‘navigationBar.backButtonItem’ you method disabled this for all pages, meaning I could never navigate back – with a little tweak this works as intended with the code:

     

        FocusScope {
            id: mainView
            focus: true
            Keys.onBackPressed: {
                if(stack.currentPage === homePage) {
    //homePage is the id of the page i do not want to navigate back from
                } else {
                    stack.pop()
    //allows other pages to be popped
                }
    
            }
        }
    
    

     

     

    If there would be a better method than this please let me know 🙂

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

RSS feed for this thread

You must be logged in to reply to this topic.

Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded