Although many people on the Internet use Redhat or Fedora as the host operating system, I think it is most convenient to use Ubuntu, because most of the required software packages can be installed through apt-get without having to compile it yourself from the source code. You know, compiling source code yourself is not an easy task, because unexpected and inexplicable errors often occur during the compilation process.
The operating system we use is Ubuntu 8.04. Using the latest version of QT 4.4.0, installation is simple. Just run the following command:
sudo apt-get install qt4-dev-tools qt4-doc qt4-qtconfig qt4-demos qt4-designer
Note that in this version of the software package, qt4-dev-tools includes tools such as Qt Assistant and Qt Linguist, so there is no need to install these two tools separately. In addition, qt4-doc is a help document that contains detailed descriptions of each class library in Qt and rich example programs. You can use the Qt Assistant tool to open and read. qt4-qtconfig is a dialog box for configuring the Qt environment. Generally, the default is enough, and it is rarely necessary to change it. qt4-demos contains many executable files and source code that can be run. qt4-designer is a designer used to design GUI interfaces.
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
Compared with installing and configuring Qt's MySQL driver under Windows, it is simply too convenient. If you need other Qt libraries that are not installed by default, you can enter sudo apt-get install libqt4- on the command line and press the tab key to complete it automatically. All software packages starting with libqt4- will be listed, as shown in the following figure:
All of this can be done with one command, without the need to compile it from source code yourself. When you can't remember or don't know the name, using the tab key to list all optional software packages is a very practical trick.
In my project, I also need to draw some data curves and statistical charts, and the third-party QWT library provides these functions. Again, only one command is needed to complete the installation:
sudo apt-get install libqwt5-qt4 libqwt5-qt4-dev
At this time, when you open Qt Designer, you will find that the "Qwt Widget" group is added to the Widget list on the left.
Finally, regarding the integrated development environment, I think QDevelop is very good. It integrates well with Qt Designer and has the function of prompting class member functions. Run the following command to install:
sudo apt-get install qdevelop
In this way, using Qdevelop to write code, compile, and debug, and using Qt Designer to design the interface, the development efficiency is higher.