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.