1、工程文件: *.pro
工程文件定义了Qt用的类库、目标程序的文件名、采用模板、C++源文件、C++头文件和样式文件
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = test2
TEMPLATE = app
# The following define makes your compiler emit warnings if you use
# any feature of Qt which has been marked as deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
CONFIG += c++11
SOURCES += \
main.cpp \
mainwindow.cpp
HEADERS += \
mainwindow.h
FORMS += \
mainwindow.ui
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
2、样式文件: *.ui
样式文件定义了人机交互界面,在此设计模式下所见即所得,在编辑模式下是XML定义文件。编译器在编译样式文件时,会将XML资源文件编译成C++头文件ui_mainwindow.h,该文件创建了主窗口界面类UI_Window,封装了样式文件中的窗口和控件。该头文件在QT工程存放目录可以找到。
3、头文件: *.h
头文件列出本工程包含的用户头文件。
4、源文件: *.cpp
源文件包含本工程包含的用户C++源文件