I have written the first meego touch program. I believe you will also see the interface style and Display Effect of meego touch. But there is no page Jump, and return effects, so this article will study how to achieve page Jump and return?
By default, meego touch disables the current page by using the return key or return key, and returns to the previous page.
So the following code redirects the page. The final effect is as follows:
When the program starts, the first page is displayed. Click "open second page" above to go to the second page.
Click the return button on the second page to close the current page and jump back to the first page.
Main Code introduction:
In the opennextpage () function, create a secondpage object and call the appear Method for display.
# Include "firstpage. h "# include firstpage: firstpage (): mapplicationpage (0) {qstring title, buttontitle, labeltitle; Title =" first page "; buttontitle =" open second page "; settitle (title); mbutton * button = new mbutton (buttontitle); Connect (button, signal (clicked (), slot (opennextpage (); setcentralwidget (button );} void firstpage: opennextpage () {secondpage * secondpage = new secondpage (); secondpage-> appear (scene (), mscenewindow: destroywhendismissed);} firstpage. h
# Ifndef firstpage_h # define firstpage_h # include class firstpage: Public mapplicationpage {q_objectpublic: firstpage (); Private slots: void opennextpage () ;}; # endifsecondpage. CPP, create the second page, set the Form title, add a label, and display I am in second page
# Include "secondpage. H "# include secondpage: secondpage (): mapplicationpage (0) {qstring title, labeltitle; Title =" second page "; labeltitle =" I am in second page "; settitle (title); setcentralwidget (New mlabel (labeltitle);} secondpage. h
# Ifndef secondpage_h # define secondpage_h # include class secondpage: Public mapplicationpage {q_objectpublic: secondpage () ;}; # endif start the terminal in the file, execute qmake-project, and generate XXX. pro file, open the file, add config + = meegotouch, save and exit.
Then execute qmake and make in sequence.
After make is executed, an execution file is generated under the folder. The result is displayed through sudo./<program name>.