Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Highlighted
Developer
Posts: 31
Registered: ‎05-18-2014
My Device: z10
My Carrier: du

onclick of button load main.qml file

HI all,

 

There is a requirement in our app, that onclick of logout or any button.. the app need to load the homepage (i.e main.qml) .. Not sure how to achieve this.

 

Here is main.qml file code

NavigationPane {
    id: mNavigationPaneMain
Page {
    
   onCreationCompleted: {
       Qt.employeeIDset = '';
   }
    Container {
        horizontalAlignment: HorizontalAlignment.Fill
        verticalAlignment: VerticalAlignment.Fill
        layout: DockLayout {
        }

    // here goes main page code....
     }
}

 From main page it goes to  Secondpage.qml

 

 How i naviagte to secondpage.qml is  like below...

var landingPage = mLandingpagePush.createObject();
landingPage.mNavigationPaneMain = mNavigationPaneMain;
mNavigationPaneMain.push(landingPage);

 ComponentDefinition {
            id: mLandingpagePush
            source: "secondpage.qml"
        },

 

AND in the second page i need to wrtie a code like.. onclick of a button it has to go to main.qml file

 

How to achieve this...

 

thank you in advance...............

 

 

Developer
Posts: 543
Registered: ‎08-31-2013
My Device: Q10, Z10LE, Nokia N950, DAB....
My Carrier: Telekom Slovakia

Re: onclick of button load main.qml file

Just call the pop() function of NavigationPane.

mNavigationPaneMain.pop()



If helped give a like. If your problem was solved mark the post as "Solution"
Portfolio: BlackBerry Nokia
Social: Twitter | Facebook
About Me / Blog DevPDA | Blog
Developer
Posts: 16,992
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: onclick of button load main.qml file

or if there are multiple pages call pop as long as the pagecount is > 1
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter