Skip to content

Commit cd953a9

Browse files
committed
[统一配置与C++20升级]: 重构项目配置并启用C++20标准
- 将各模块的重复配置(`CONFIG += c++17`、`QT_DEPRECATED_WARNINGS`等)统一收归至`common.pri`,实现集中管理 - 全局启用C++20标准,同步更新CMake配置文件(`cmake/common.cmake`)并添加编译器版本校验 - 移除各`.pro`文件中冗余的Qt版本检查逻辑,改由`common.pri`统一定义`QT_DISABLE_DEPRECATED_BEFORE=0x060000` - 重构日志模块同步机制,使用C++20的`std::binary_semaphore`替代旧版Qt线程同步原语 - 调整资源文件引用顺序,修复部分模块资源文件重复包含问题 - 更新Windows资源文件元数据,统一产品信息为"Qt-Examples"系列标识
1 parent 166abed commit cd953a9

35 files changed

Lines changed: 127 additions & 326 deletions

File tree

Battery/Battery.pro

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,9 @@
1+
include(../common.pri)
2+
13
QT += core gui
24

35
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
46

5-
CONFIG += c++17
6-
7-
# The following define makes your compiler emit warnings if you use
8-
# any Qt feature that has been marked deprecated (the exact warnings
9-
# depend on your compiler). Please consult the documentation of the
10-
# deprecated API in order to know how to port your code away from it.
11-
DEFINES += QT_DEPRECATED_WARNINGS
12-
13-
# You can also make your code fail to compile if it uses deprecated APIs.
14-
# In order to do so, uncomment the following line.
15-
# You can also select to disable deprecated APIs only up to a certain version of Qt.
16-
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
17-
187
SOURCES += \
198
batterywidget.cpp \
209
main.cpp \

Bootstrap/Bootstrap.pro

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
1+
include(../common.pri)
2+
13
QT += core gui
24

35
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
46

5-
CONFIG += c++17
6-
7-
# You can make your code fail to compile if it uses deprecated APIs.
8-
# In order to do so, uncomment the following line.
9-
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
10-
117
SOURCES += \
128
main.cc
139

@@ -26,10 +22,10 @@ unix:!macx{
2622
SOURCES += bootstrap_linux.cc
2723
}
2824

25+
RESOURCES += \
26+
resouce.qrc
27+
2928
# Default rules for deployment.
3029
qnx: target.path = /tmp/$${TARGET}/bin
3130
else: unix:!android: target.path = /opt/$${TARGET}/bin
3231
!isEmpty(target.path): INSTALLS += target
33-
34-
RESOURCES += \
35-
resouce.qrc

BubbleWindow/BubbleWindow.pro

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,9 @@
1+
include(../common.pri)
2+
13
QT += core gui
24

35
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
46

5-
CONFIG += c++17
6-
7-
# The following define makes your compiler emit warnings if you use
8-
# any Qt feature that has been marked deprecated (the exact warnings
9-
# depend on your compiler). Please consult the documentation of the
10-
# deprecated API in order to know how to port your code away from it.
11-
DEFINES += QT_DEPRECATED_WARNINGS
12-
13-
# You can also make your code fail to compile if it uses deprecated APIs.
14-
# In order to do so, uncomment the following line.
15-
# You can also select to disable deprecated APIs only up to a certain version of Qt.
16-
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
17-
187
SOURCES += \
198
bubblewidget.cpp \
209
main.cpp \

Chart/Chart.pro

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,9 @@
1+
include(../common.pri)
2+
13
QT += core gui charts
24

35
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
46

5-
CONFIG += c++17
6-
7-
# The following define makes your compiler emit warnings if you use
8-
# any Qt feature that has been marked deprecated (the exact warnings
9-
# depend on your compiler). Please consult the documentation of the
10-
# deprecated API in order to know how to port your code away from it.
11-
DEFINES += QT_DEPRECATED_WARNINGS
12-
13-
# You can also make your code fail to compile if it uses deprecated APIs.
14-
# In order to do so, uncomment the following line.
15-
# You can also select to disable deprecated APIs only up to a certain version of Qt.
16-
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
17-
187
SOURCES += \
198
areachart.cpp \
209
callout.cpp \

CheckBoxStandardItem/CheckBoxStandardItem.pro

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
1+
include(../common.pri)
2+
13
QT += core gui
24

35
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
46

5-
CONFIG += c++17
6-
7-
# You can make your code fail to compile if it uses deprecated APIs.
8-
# In order to do so, uncomment the following line.
9-
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
10-
117
SOURCES += \
128
checkboxstandarditem.cc \
139
main.cc \

Clock/Clock.pro

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,9 @@
1+
include(../common.pri)
2+
13
QT += core gui
24

35
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
46

5-
CONFIG += c++17
6-
7-
# The following define makes your compiler emit warnings if you use
8-
# any Qt feature that has been marked deprecated (the exact warnings
9-
# depend on your compiler). Please consult the documentation of the
10-
# deprecated API in order to know how to port your code away from it.
11-
DEFINES += QT_DEPRECATED_WARNINGS
12-
13-
# You can also make your code fail to compile if it uses deprecated APIs.
14-
# In order to do so, uncomment the following line.
15-
# You can also select to disable deprecated APIs only up to a certain version of Qt.
16-
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
17-
187
SOURCES += \
198
clockwidget.cpp \
209
main.cpp \

DashBoard/DashBoard.pro

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,9 @@
1+
include(../common.pri)
2+
13
QT += core gui
24

35
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
46

5-
CONFIG += c++17
6-
7-
# The following define makes your compiler emit warnings if you use
8-
# any Qt feature that has been marked deprecated (the exact warnings
9-
# depend on your compiler). Please consult the documentation of the
10-
# deprecated API in order to know how to port your code away from it.
11-
DEFINES += QT_DEPRECATED_WARNINGS
12-
13-
# You can also make your code fail to compile if it uses deprecated APIs.
14-
# In order to do so, uncomment the following line.
15-
# You can also select to disable deprecated APIs only up to a certain version of Qt.
16-
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
17-
187
SOURCES += \
198
dashboardwidget.cpp \
209
main.cpp \

DragDrop/DragDrop.pro

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,9 @@
1+
include(../common.pri)
2+
13
QT += core gui
24

35
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
46

5-
CONFIG += c++17
6-
7-
# The following define makes your compiler emit warnings if you use
8-
# any Qt feature that has been marked deprecated (the exact warnings
9-
# depend on your compiler). Please consult the documentation of the
10-
# deprecated API in order to know how to port your code away from it.
11-
DEFINES += QT_DEPRECATED_WARNINGS
12-
13-
# You can also make your code fail to compile if it uses deprecated APIs.
14-
# In order to do so, uncomment the following line.
15-
# You can also select to disable deprecated APIs only up to a certain version of Qt.
16-
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
17-
187
SOURCES += \
198
draglistwidget.cpp \
209
droplistwidget.cpp \
@@ -30,18 +19,3 @@ HEADERS += \
3019
qnx: target.path = /tmp/$${TARGET}/bin
3120
else: unix:!android: target.path = /opt/$${TARGET}/bin
3221
!isEmpty(target.path): INSTALLS += target
33-
34-
# Output directory
35-
CONFIG(debug, debug|release) {
36-
output = debug
37-
TARGET = $$TARGET
38-
}
39-
CONFIG(release, debug|release) {
40-
output = release
41-
}
42-
43-
DESTDIR = bin
44-
OBJECTS_DIR = $$output
45-
MOC_DIR = $$output
46-
RCC_DIR = $$output
47-
UI_DIR = $$output

FlowLayout/FlowLayout.pro

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
1+
include(../common.pri)
2+
13
QT += core gui
24

35
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
46

5-
CONFIG += c++17
6-
7-
# You can make your code fail to compile if it uses deprecated APIs.
8-
# In order to do so, uncomment the following line.
9-
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
10-
117
SOURCES += \
128
flowlayout.cpp \
139
flowwidget.cc \

GridViewModel/GridViewModel.pro

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
1+
include(../common.pri)
2+
13
QT += core gui
24

35
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
46

5-
CONFIG += c++17
6-
7-
# You can make your code fail to compile if it uses deprecated APIs.
8-
# In order to do so, uncomment the following line.
9-
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
10-
117
SOURCES += \
128
gridmodel.cpp \
139
gridview.cpp \

0 commit comments

Comments
 (0)