Ubuntu10.04 Install QT4 and create the first QT program

Source: Internet
Author: User

1. First install QT4 and use QT Creator for development demonstration

(1) Enter in Terminal:

sudo apt-get install qt4-dev-tools qt4-doc qt4-qtconfig Qt4-demos Qt4-designer

which

The qt4-dev-tools includes Qt assistant,qt linguist,qt Creator
Qt4-doc This is a help document
Qt4-qtconfig qt Configuration Tool, this is installed by default good
Qt4-demos some of the official demo
Qt4-designer Visualization form setup Tool

After the installation is complete, you will see more Qt Creator, QT4 Assistant, Qt4 designer, Qt linguist, and so on under "programming with Applications"

2. Use QT Creator to create my first QT program Hello World

1. Create a new empty Qt4 project, select a different project, and select an empty QT project on the right.

2. The project is then named, followed by the wizard, and the project is built.

3. In the QT creator menu bar, select Form--show sidebar, and you can now see the project you just created.

4. Right-click the project folder, tap "Add New File", select the C + +->c++ source file here, or select the profile-----text file, just add the suffix when you name it below. cpp. The file name is not necessarily written in main.cpp, any name can be.

5 Edit the source code, click on the bottom left corner of the first green triangle button is OK.

1 #include <QApplication>
2 #include <QLabel>

4 int main (int argc, char *argv[])
5 {
6 qapplication app (argc, argv);
7 Qlabel Hello ("8 hello.show ();
9 return app.exec ();
10}

6 The results of the program operation are as follows:

The code in line seventh can also be used without UML code, directly

Qlabel Hello ("Hello qt!");

Ubuntu10.04 Install QT4 and create the first QT program

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.