Setup and initial experience of QT4 development environment in Ubuntu

Source: Internet
Author: User
Tags qt designer
There are two major problems with Qt4 installation in Linux: environment variables and IDE (integrated development environment ). There are two ways to install Qt4, one is apt-get, the other is to download the source code package, and the other is already proved to be the most difficult way. So I finally adopted the apt-get method. Apt-get also has two methods (this is the unpleasant thing about FreeOS): New and command line. We strongly recommend that you use the command line! Because everything in the new version is too messy, you may have downloaded a lot of things, but none of them are

There are two major problems with Qt4 installation in Linux: environment variables and IDE (integrated development environment ). There are two ways to install Qt4, one is apt-get, the other is to download the source code package, and the other is already proved to be the most difficult way. So I finally adopted the apt-get method. Apt-get also has two ways (this is the uncomfortable aspect of Free OS): New and command line. We strongly recommend that you use the command line! Because everything in the new version is too messy, you may download a lot of things, but none of them are what we really need. After the download is complete, you need to configure the environment variables on your own.

With regard to IDE, some people set KDevelop to run Qt on the Internet, but it is not very good. There are still headers that cannot be found at critical moments. QDevelop is the official IDE of Qt. It is said that it works better with Qt4, so I chose this.

Use apt-get to install Qt4:

To configure Qt4 in Ubuntu Linux (my version is Ubuntu 9.10 ):

1. Install Ubuntu 9.10 on your computer or virtual machine.

2. modify and update the source. For more information, see "quick Configuration Guide" at wiki.ubuntu.org.cn ".

3. Please do not install any software updates without your preferences.

4. Start the terminal and run the command: sudo apt-get install build-essential.

5. Wait.

6, sudo apt-get install libqt4-dev libqt4-dbg libqt4-gui libqt4-sql qt4-dev-tools qt4-doc qt4-designer qt4-qtconfig

Note that in this version of the software package, the qt4-dev-tools contains tools such as Qt Assistant and Qt Linguist, so you do not need to install them separately. Others, qt4-doc is a help document that contains detailed descriptions of various class libraries in Qt and a wide range of example programs that can be opened using Qt Assistant tools. The qt4-qtconfig is a dialog box for configuring the Qt environment, which is usually the default and is rarely necessary to change. The qt4-demos contains many executable files and source code that can run. A qt4-designer is a designer used to design a GUI.

7. wait and pray.

8. If you want to use QDevelop, sudo apt-get install qdevelop.

9. If you use QDevelop, start it directly. You may find prompts such as "Qt Folder does not exist", because some tools have not been installed, such as qmake, ctags and so on, do not be scared by the small Red Cross, execute the following statement can: sudo apt-get install libqt4-dev.

10. There may be a Red Cross of ctags here. You can execute: apt-get install ctags, which will automatically help you find and install it. This is really convenient. Then, the environment variable does not prompt errors. You can go to Qdevelop to coding!

Appendix: What I see during online data query may be useful in the future:

1. In order to connect to the MySQL database, you need to install the driver to connect to MySQL: sudo apt-get install libqt4-sql-mysql

It is much easier to install and configure the Qt MySQL driver in Windows. If you need other Qt libraries that are not installed by default, you can enter sudo apt-get install libqt4 in the command line and press the tab key to automatically complete the installation, all software packages starting with libqt4-are listed. You can use a command to complete these operations without compiling the source code. It is a practical tips to use the tab key to list all optional software packages without knowing the name.
2. In my project, I also need to draw some data curves and statistical charts, which are provided by a third-party QWT library. Similarly, you only need a command to complete the installation: sudo apt-get install libqwt5-qt4 libqwt5-qt4-dev, then open Qt Designer, the "Qwt Widget" group is added to the left Widget list.

3. Regarding the integrated development environment, I think QDevelop is very good. It works well with Qt Designer and has the function of prompting class member functions. Use Qdevelop to write code, compile and debug, and use Qt Designer to design the interface, which is highly efficient in development.

Related Article

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.