5th Lesson Qt Creator Engineering Introduction

Source: Internet
Author: User

1. QT Creator Project Management (a project package with different types of files)

(1). Pro Project file

(2). Pro.user User Configuration description file

(3). h header File

(4). cpp Source Files

(5). UI Interface Description File

(6) Resource files (Pictures, audio, etc.)

2.. Pro Project description file

2.1. Pro the basic composition of the project description file

(1) #: Comment Start character

(2) QT: module declaration

(3) TARGET: executable file name

(4) Template: Declaration of program Templates

(5) SOURCES: source file Declaration

(6) HEADERS: header file declaration

(7) FORMS: interface file declaration

(8) Rc_file: Resource file statement

2.2. Pro Advanced Variables in the project description file

(1) Includepath: Header File Search path

(2)config: Set configuration information and compilation options for the project

(3) LIBS: Add a third-party library file

(4) Defines: Define compilation macros

2.3 Pro the nature of the file (makefile file in Qt)

2.3 CONFIG Configuration

(1) config to set configuration information and compile options for the project

(2) Common options for Config

①debug: Building the Debug version of the executable program

②release: Build an executable program for release version

③debug_and_release: Build both Debug and release versions

④WARN_ON: As many output warning messages as possible

⑤warn_off: Do not output warning message

(3) Precautions:

①config can define both debug and release, but only one is active (when two mutually exclusive values are present, the last set is in Active state)

config (debug, debug|release) meaning : suppose config + = release Debug release debug Release Debug.

DetermineWhether debug appears in the last of the config settings for such a debug and release mutex. If yes, returns TRUE.

▲ usually when the qmake is processed in. Pro files, it is processed 3 times, once for debug, one for release, and the last for Debug_and_release

"Instance analysis". Pro Project File Analysis

#-------------------------------------------------# # NAME:QT Creator Project demo# author:santa Claus # Date: .-Geneva- A##-------------------------------------------------QT+ = Core GUI//indicates that the project requires Qtgui and Qtcore two modules, QT contains these two modules by default//modules that can also be added are: Widgets, network, XML, quick, multimedia, SQL,//WebKit and so on, you can refer to QTSDK (in the Assistant index mode, enter "variables"//Find the variable "QT" and click on the appropriate link to go in)GreaterThan (qt_major_version,4): QT + = Widgets//no independent qtwidgets module prior to Qt5//from the QT5, Qtwidgets was separated from the Qtgui module.TARGET= HelloWorld//the target file name, typically the same as the project file nameTEMPLATE = App//used to set the build type of the project, and if not set, the project will be built by default "Apply", the main template://1. App: Default template, Qmake will generate a makefile to build the app//2. Lib: library, building the makefile of a dynamic library or a static library//3. Subdirs: subdirectory item, Qmake generates a makefile based on the subdirs variable, which makefile//contains the logic to build subdirectories, where pro files must exist in subdirectories//4. Vcapp: Generate a project file (. vcproj) for Visual Studio for VS use//5. Vclib: Generate a dynamic or static library of VS//6. Vcsubdirs will generate a solution file (. sln) of VS, which contains each subdirectory corresponding to the//project file (. vcproj), you can open this solution with VSIncludepath+ = e:/bcc/include \//Includepath: Specifies the header file directory of the 3rd party Library, which is from this when using relative paths. ProE:/vc/include//the directory where the file itself begins. SOURCES+ = Main.cpp \//sources variable: Used to specify the source files that the project contains, multiple source files are separated by spaces,HelloWorld.cpp//If one line does not fit, you can "\" to wrapHEADERS+ = HelloWorld.h//Specify header files, separated by a space between multiple headersFORMS+ = Helloworld.ui//FORMS: Used to set the interface file to useRc_file+ = Myico.rc//rc_file: Used to set the resource file to useLIBS+ =-le:/mylib/lib-lmath//LIBS: 3rd party library file (not header file)//where the-l prefix represents a library directory, such as E:/mylib/lib//- L (lowercase l) specifies a specific library, such as the math//       CONFIG+ = warn_on Debug//Config: Configuration information, which represents as much detail as possible warning information, while building the debug version//1. QT: The default configuration includes this configuration, can be removed with config-= qt//2. Release: Build release version//3. Debug: Build Debug Version//4. Debug_and_release: Build both Release and debug versions. Debug, Release//debug_and_release These few options, which is the last//one configuration, you use whichever//5. Warn_on and Warn_off: Turn warning messages on or off## if 'Debug'Option is Set  forconfig#config (Debug) {//determine if the debug versionDefines + =Debug_log SOURCES+=DebugLog.cpp HEADERS+=DebugLog.h}

3. Project Documents

(1) In general, the description in the project file is the use of relative paths (as opposed to the project file itself)

(2) Qt creator the project file as the target file

①QT creator the. pro.user file is generated while the project file is open

The ②.pro.user file contains some local configuration information related to Qt and is recommended to be removed when you need to move the source of the project between different computers. Pro.user

Creation and analysis of Qt creator project of "Programming Experiment"

Create project → select template "Application" → "Qt Widgets application"

4. Summary

(1) Qt Creator Management of the source code in the way of project

(2) A QT Creator project contains different types of files

(3). Pro files are used to configure and organize information about the entire project

(4). Pro file is a platform-independent makefile file in QT

(5) Qt Creator provides fast and efficient functions necessary for development

5th Lesson Qt Creator Engineering Introduction

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.