当前位置:网站首页>Introduction to the basic application and skills of QT
Introduction to the basic application and skills of QT
2022-07-03 09:06:00 【R-G-B】
qt Introduction to basic application and skills
1 .pro file
In the use of Qt Wizard generated applications .pro The file format is as follows :
QT += core gui // Included modules
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets // Greater than Qt4 edition To include widget modular
TARGET = QtFirst // Application name Generated .exe Program name
TEMPLATE = app // Template type Application template
SOURCES += main.cpp\ // Source file
mywidget.cpp
HEADERS += mywidget.h // The header file
.pro It's engineering documents (project), It is qmake Automatically generated for production makefile Configuration file for ..pro The document is written as follows :
• notes
from “#” Start , By the end of the line .
• The template variable tells qmake What kind of... Is generated for this application makefile. Here are the options available :TEMPLATE = app
◦ app - Build an application of makefile. This is the default , So if the template is not specified , This will be used .
◦ lib - Build a library of makefile.
◦ vcapp - Build an application of VisualStudio Project documents .
◦ vclib - Build a library of VisualStudio Project documents .
◦ subdirs - This is a special template , It can create a directory that can enter a specific directory and generate... For a project file makefile And call... For it make Of makefile.
•# Specify the name of the generated application :
TARGET = QtDemo
• # The header file included in the project
HEADERS += include/painter.h
• # The project includes .ui Design documents
FORMS += forms/painter.ui
• # Source files included in the project
SOURCES += sources/main.cpp sources
• # Resource files included in the project
RESOURCES += qrc/painter.qrc
• greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
The meaning of this sentence is , If QT_MAJOR_VERSION Greater than 4( That is, the current Qt5 And higher ) Need to increase the widgets modular . If the project only needs support Qt5, You can also add “QT += widgets” A word of . But to keep the code compatible , It's better to follow QtCreator The generated statements are written .
• # Configuration information
CONFIG To tell qmake Configuration information about the application .
CONFIG += c++11 // Use c++11 Characteristics of
Use it here “+=”, It's because we add our configuration options to any one that already exists . This is better than using “=” So it's safer to replace all the options that have been specified .
2 One of the simplest Qt Applications

3 Naming conventions and shortcut keys

边栏推荐
- LeetCode 535. Encryption and decryption of tinyurl
- Dom4j traverses and updates XML
- AcWing 788. Number of pairs in reverse order
- Use of sort command in shell
- LeetCode 508. 出现次数最多的子树元素和
- Divide candy (circular queue)
- Discussion on enterprise informatization construction
- AcWing 785. 快速排序(模板)
- Using DLV to analyze the high CPU consumption of golang process
- 【点云处理之论文狂读经典版11】—— Mining Point Cloud Local Structures by Kernel Correlation and Graph Pooling
猜你喜欢
随机推荐
LeetCode 241. Design priorities for operational expressions
DOM render mount patch responsive system
C language file reading and writing
传统企业数字化转型需要经过哪几个阶段?
First Servlet
Wonderful review | i/o extended 2022 activity dry goods sharing
PHP function date (), y-m-d h:i:s in English case
Gif remove blank frame frame number adjustment
樹形DP AcWing 285. 沒有上司的舞會
记忆化搜索 AcWing 901. 滑雪
LeetCode 513. 找树左下角的值
LeetCode 513. Find the value in the lower left corner of the tree
【点云处理之论文狂读前沿版10】—— MVTN: Multi-View Transformation Network for 3D Shape Recognition
LeetCode 75. Color classification
Dom4j traverses and updates XML
TP5 multi condition sorting
AcWing 785. 快速排序(模板)
精彩回顾|I/O Extended 2022 活动干货分享
LeetCode 715. Range 模块
Sword finger offer II 091 Paint the house









