Two-day study of QT Programming

Source: Internet
Author: User

Study Notes:

 

Dynamic library *. So

Static library *.

 

The standard header file is under/usr/include, which is automatically searched by default during system compilation.

In the command, you can add-I <LIBRARY PATH> to the specified header file to search for your own header file.

 

The default link library search path is/usr/lib and/lib.

 

-L specific database name to be linked

-L path to search for additional libraries

Example: G ++ hello. cpp-O hello-I/usr/lib/qt-3.1/include-lqt-L/usr/lib/qt-3.1/lib

Explanation:-lqt indicates link to the QT library, where the QT library name under/usr/lib/qt-3.1/lib is libqt. So

-L/usr/lib/qt-3.1/lib represents the path under/usr/lib/qt-3.1/lib

 

However, it is troublesome to write as above. You can use the following command to simplify

# Export ld_librar_path =/usr/lib/qt-3.1/lib

# Export cplus_include_path =/usr/lib/qt-3.1/include

After the environment variables are improved, run the following command:

# G ++ hello. cpp-O hello-lqt

Complete Compilation

 

But the above method is still troublesome. The best way is to create a file for each project.

Compile with the following commands:

# Qmake-Project

# Qmake

# Make

This completes the compilation.

 

Note that the header file and definition must be written in two files when the custom slot and signal are used: Write A. H file and. cpp file. This separation of writing is also advocated by code writing.

 

At qt4.3.5, the compilation method is the same as that of qt3.1. The biggest difference is the usage Syntax of some classes.

For example, if qt4.3.5 does not have setmainwidget (), and The plotting event in qt4.3.5 does not have to write a plotting function between paintbegin and paintend as in 3.1.

 

The greatest helper for learning QT is QT Assistant, which can be used to search for various types, member functions, etc. With it, you can achieve self-connection without division. The command is as follows:

# Assistant &

Let it run in the background. If we don't understand it, we can look for him. When we don't use it, it doesn't affect front-end work.

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.