Install Qt4 and create the first Qt program under Ubuntu10.04

Source: Internet
Author: User
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! ");

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.