Meego touch enables page Jump and return

Source: Internet
Author: User

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>.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.