One of QT learning notes-download, installation, and configuration of QT SDK

Source: Internet
Author: User

 

Copyright:
Original Works are allowed to be reprinted. During reprinting, please mark the article in hyperlink form
Original source, author information, and this statement. Otherwise, legal liability will be held. Http://alwayzy.blog.51cto.com/2109731/387464

Name: Download, installation, and configuration of qt sdk, one of QT learning notes
Author: alwayzy
Email: alwayzy@gmail.com
Time: 2010.09.04

Disclaimer: reprinted, please indicate the source

About the picture in the article can not be normally displayed, the three pictures are all localized, that is, all reference from the album http://hi.baidu.com/cobala, but Baidu's protection mechanism to their own is also isolated, so friends who can not see the picture can go to the http://hi.baidu.com/cobala album "Default album" to view the picture.

The interest in QT (its official Chinese website http://qt.nokia.com/title-cn) is not a day or two days, finally began to learn. After several days of contact, I encountered some problems, and I had some experiences and understandings. I recorded them so that I could not forget them in the future. I also gave some reference to my friends and later who encountered the same problems.

After so many years of development, QT has developed into a complete cross-platform desktop application development solution based on C ++. With the introduction of the authorization protocol lgpl after Nokia's acquisition and the continuous optimization and enhancement of the integrated development environment, especially the release and constant update of the new QT creator, it is bound to promote Qt in windows, more platforms and fields, such as UNIX and mobile platforms, are evolving.

Step 1: download and install the QT SDK
Download the latest QT-SDK installation package from the official QT website http://qt.nokia.com/downloads-cn, the latest version as of this article is 2010.04. Qt SDK includes the latest and complete QT 4.6.3 library, QT creator 2.0 and QT
Designer and other development tools. Currently, the official qt sdk for five platforms is
Windows, Linux (32-bit, 64-bit), Mac
Version and
Nokia qt sdk (several versions are available for different development platforms ). This document only applies to
The installation on Windows and Linux/32-bit platforms is briefly introduced.
First introduce Windows platform, download
Qt SDK for Windows (293 MB), address:
Http://get.qt.nokia.com/qtsdk/qt-sdk-win-opensource-2010.04.exe, the SDK Development Kit is based on mingw tool set. Download and double-click the qt-sdk-win-opensource-2010.04.exe to install, installation process can customize the installation path, but the path cannot have Chinese characters! We recommend that you directly use the default installation path. To install software for foreigners, do not use the path containing 'a'-'Z', 'a'-'Z', '0'-'9 ', '. the path name of characters other than ','-',' _ 'to avoid many inexplicable and unreasonable problems. After the installation is complete, it will be created on the desktop.
Qt creator to the shortcut, double-click the shortcut to enter the QT to the visual development environment. In QT creator IDE, programs can be compiled, compiled, debugged, and run without additional configuration. However, Note: if development tools such as VC are installed in the system, these tools may add include, Libs, and other variables to the system's environment variables to facilitate compilation and generation of programs using tools such as nmake in the command line, however, these settings conflict with QT creator IDE. If you do not need to perform command line operations, you can delete include and libs, so that QT creator
When compiling the QT program in the IDE environment, the header file and library in the installed qt sdk will be used.
The installation in Linux is much simpler. I use ubuntu (kubuntu is the same). The default installation of ubuntu (kubuntu) also requires the installation of the GNU compilation tool set, otherwise, QT creator cannot compile the linked program. The installation command is as follows:
$ Sudo apt-Get install build-essential
Download the SDK using wget or multiget.
Qt SDK for Linux/X11 32-bit (371 MB), address is

Http://get.qt.nokia.com/qtsdk/qt-sdk-linux-x86-opensource-2010.04.bin. After the installation package is complete, add the executable permission for the installation package on the terminal.

 
 
  1. $ chmod u+x qt-sdk*

Then

 
 
  1. $ ./qt-sdk*

Run the installation package.
By default, it is installed in the current user directory.

 
 
  1. sudo ./qt-sdk*

Installation will be installed in the/OPT directory.
During installation, you will be prompted to manually install libglib2.0-Dev, libsm-Dev, libxrender-Dev, libfontconfig1-dev, libxext-Dev, if you need OpenGL, you also need to install libgl-Dev and libglu-Dev, and these two libraries are in the libglu1-mesa-dev package. Therefore, a command to install the complete dependency package is:

 
 
  1. $ sudo apt-get install   libglib2.0-dev libSM-dev libxrender-dev libfontconfig1-dev libxext-dev libglu1-mesa-dev

After manually adding the extension dependency package, continue to next to complete the installation of qt sdk for Linux/X11 32-bit.
After the installation is complete, there will be a shortcut for Qt Creator on the desktop. Double-click the shortcut to open the IDE environment of QT creator.

Step 2: Configure and use QT creator
After the above installation process, QT creator can work well without any configuration. Of course, in order to meet your usual usage habits, you can open the parameter settings window, such as the Code Editor, debugger, QT library, and UI Designer, through the IDE Main Menu "Tools"-"options, the default project parameters, version control tools, and so on are set. The specific settings are not fully understood by myself because of the large amount of content involved, I only want to introduce some of the functions that I think are important but hidden. I believe you can find the parameter configurations that suit your usage habits. If you cannot find them, let's get used to it. This is the way users get used.
1. Activate different projects in multiple open projects. To be honest, I have been searching for the menu or function of this switchover for a long time and finally found it by accident. 1:

<Figure 1>
You can select an active project from the drop-down list where the cursor is located. Click result 2 in the drop-down list:


<Figure 2>
We can see that I opened two projects untitled and untitled1. The project name is displayed in bold in the project list in the main window of QT creator IDE. 3. untitled project:


<Figure 3>
2. Switch the debug and release configurations of the project. In Figure 1, you can see a down list box shown as "debug" below the mouse. Click this box to switch between debug and release or more configurations of the same project.
3. Manage project configuration. In the list on the left of the Main Window of QT creator IDE, select projects to view different projects in the window on the right (select from the tab page) modify the generation settings, run settings, editor (encoding used by the source code file) settings, and project dependency settings. The configuration of the project can be added or deleted in the generation settings. By default, both Debug and release configurations are automatically generated in the IDE environment. You can also modify the parameters of the existing configuration, for example, the QT library used for this configuration, qmake command parameters, and custom generation steps.
4. Switch the source code file. Because the code editor of QT creator ide does not use the tab page to manage open source code files, you should also mention switching files, there are two ways to switch between opened files. One is to double-click the files in the "open documents" list under the default layout, the other is to use the drop-down list on the right of the Go forward button (a right arrow) on the toolbar above the code editing window.
5. Set the breakpoint and debug. In QT creator IDE, the shortcut keys are supported for debugging and setting breakpoints, which are the same as those in VC by default, that is, F5-start debugging, Shift + F5-end debugging, f9-set/cancel breakpoint, F10-Step over, F11-Step into, Shift + F11-Step out and so on.
Most of the interface elements in QT creator ide have tooltip prompts. After you place the cursor on it, you can enter the description of the item and the shortcut key name (if this operation supports the shortcut key), which is very convenient and intuitive.

Step 3: test the environment
The qt sdk comes with many sample programs installed in the qtsdk-2010.04/QT/demos and qtsdk-2010.04/QT/examples directories. You can select a QT project file (Suffix: Pro) from the main menu "file"-"Open file or project" of QT creator IDE ), compile and debug the IDE environment with the correct project. You can also test it on the welcome interface of QT creator IDE, use "choose an example" to open an example Program
Environment.

Step 4: everything is ready.
After installation, configuration, and testing, you can write your own QT application. How to write? Well, you can write a thick and thick book.

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.