Learn QT from Hello World

Source: Internet
Author: User

learning any language is basically starting from Hello world. It seems that it has become a convention, and learning QT is no exception. I have never known why such a convention should be like this. After reading other people's blogs, I realized that this was the first greeting from a new life to the world, it also reflects the respect of Program members for the world in which we live. Of course, it may be a bit too much, but it is quite a good explanation.

# Include <qtgui/qapplication>
# Include <qtgui/qlabel>
# Include <qtcore/qtextcodec>

IntMain (IntArgc,Char* Argv [])
{
Qapplication app (argc, argv );// QT must contain a qapplication instance
// Supports local languages. Otherwise, Chinese characters cannot be identified in the Program (for example, labels written in Chinese)
Qtextcodec: setcodecfortr (qtextcodec: codecforlocale ());
Qlabel label;
// Set the label text to hello World
Label. settext (qobject: TR ("Hello world!"));
Label. Show ();// Display the label

ReturnApp.exe C ();// Return the execution result of this app
}

 
 
So far, the first hello World is complete.

Appendix: please recommend a live writerCodeHighlight plug-in. Thank you.

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.