Qt5笔记(一)

 1 #-------------------------------------------------
 2 #
 3 # Project created by QtCreator 2019-08-10T22:25:23
 4 #
 5 #-------------------------------------------------
 6 
 7 QT       += core gui
 8 
 9 greaterThan(QT_MAJOR_VERSION, 4): QT += widgets     //兼容Qt4
10 
11 TARGET = w            //生成的应用程序的名字
12 TEMPLATE = app    //指定mikefile类型
13 
14 # The following define makes your compiler emit warnings if you use
15 # any feature of Qt which has been marked as deprecated (the exact warnings
16 # depend on your compiler). Please consult the documentation of the
17 # deprecated API in order to know how to port your code away from it.
18 DEFINES += QT_DEPRECATED_WARNINGS
19 
20 # You can also make your code fail to compile if you use deprecated APIs.
21 # In order to do so, uncomment the following line.
22 # You can also select to disable deprecated APIs only up to a certain version of Qt.
23 #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
24 
25 //源文件
26 SOURCES += \
27         main.cpp \
28         widget.cpp
29 
30 //头文件
31 HEADERS += \
32         widget.h
33 
34 //界面文件
35 FORMS += \
36         widget.ui
37 
38 //C++11新标准,lambda表达式会用到
39 CONFIG += C++11

 Qt的内存回收机制

只要指定父对象,直接或间接继承于QObect,那么子对象如果是动态分配空间,不需要手动释放内存,系统会自动释放。

猜你喜欢

转载自www.cnblogs.com/main404/p/11333481.html
今日推荐