1. First install Qt4 and use QtCreator for development demonstration (1) Input in Terminal: sudoapt-getinstallqt4-dev-toolsqt4-docqt4-qtconfigqt4-demosqt4-designer where: qt4-dev-tools includes QtAssistant, QtLinguist, QtCreatorqt4-doc this is
1. Install Qt4 and use Qt Creator for development demonstration.
(1) In Terminal, enter:
Sudo apt-get install qt4-dev-tools qt4-doc qt4-qtconfig qt4-demos
Where:
The qt4-dev-tools includes Qt Assistant, Qt Linguist, Qt Creator
Qt4-doc this is help documentation
Qt4-qtconfig Qt Configuration tool, which is installed by default
Some official Demo of qt4-demos
Qt4-designer visual form setup Tool
After the installation is complete, you will see more Qt Creator, Qt4 assistant, Qt4 designer, Qt Linguist, and so on under "Application-> programming ".
2. Use Qt Creator to create my first Qt program hello world
1. Create an empty Qt4 project, select another project, and select an empty Qt project on the right.
2. Name the project and follow the Wizard to build the project.
3. Select "form-> display sidebar" in the menu bar of Qt Creator. Now you can see the project you just created.
4. right-click the project folder, and click "Add new file". Here, select C ++> C ++ source file, or select overview> text file, just add the suffix when naming. cpp. The file name does not have to be written as main. cpp. It can be any name.
5. Edit the source code. Click the first green triangle button in the lower left corner.
# Include
# Include
Int main (int argc, char * argv [])
{
QApplication app (argc, argv );
QLabel hello (" HelloQt! ");
Hello. show ();
Return app.exe c ();
}
6. The program running result is as follows:
In the seventh line of the code, you can directly
QLabel hello ("Hello Qt! ");