课程代码仓库初始化:Part1 (144) + Part3 (29) 全量生成与验证

把川大 wiki「02.Qt方向」课程代码整理为 CMake 管理的可编译运行项目。

Part1 C/C++ 强化 (p01/, 144 目标, host gcc/g++ 构建, 全绿):
- 修复全部编译失败:补 <cstring>/<fstream>/<iomanip>/<vector> 等缺失头
  (common_fix + infer_stl_includes 自动检测注入)、修正 pause() 壳注入
  (改检测已转换后的 pause 调用)、namespace 提升出函数体、const 成员函数
  正确性、dedupe 不再破坏函数重载集、K&R 隐式 int / 动态异常规范等
  C++17 移除特性的可编译等价改写。
- 目录采用深缩写 p01/ch04/s03/ (原 part1_cpp/ch04_class_object/03_ctor_dtor)。

Part3 Qt 桌面 (p03/, 29 目标, 隔离 Qt 5.14.2 构建, 全绿):
- gen_part3.py: Qt 外壳模板 (main+QApplication+show, QTimer 自动退出便于
  offscreen 验证)、AUTOMOC + .moc include、rewrite_* 处理散文混入/重载/
  资源依赖、生成占位 png/gif + .qrc + rundata 样例数据。
- 修正 QLable 笔误、全角分号、.→->、Windows 路径、QApplication 阻塞事件
  循环改为 QCoreApplication 等。

任务1 概念/版本验证:
- tools/std_probe.py: 跨 -std= 编译探针 (--pedantic-errors 让已废除特性硬失败)。
- tools/demo_versions/: K&R 隐式 int、三目左值、void* 转换、enum 赋整、
  const 经指针、动态异常规范 共 6 个跨版本演示。
- docs/VERSION_NOTES.md: 每条「原文说法→C17/C++17 是否成立→何版本成立→已验证」。

文档: 顶层 README、docs/SOURCE_PAGES.md (页面→目录映射)、
docs/ERRATA.md (Part1 修正)、docs/ERRATA_part3.md (Part3 修正)。
另修复 tools/run.sh / run_qt.sh 的 ${1:?...} 引号语法 bug。

隔离 Qt 验证: ldd 0 系统 Qt 引用; 173/173 目标全绿; p03 offscreen 运行通过。
This commit is contained in:
张宗平
2026-06-30 14:16:55 +08:00
commit 13b3ebbe14
287 changed files with 16532 additions and 0 deletions
+291
View File
@@ -0,0 +1,291 @@
[
{
"id": "58954436",
"title": "01.C++技术强化及提升",
"path": [
"01.C++技术强化及提升"
]
},
{
"id": "58954437",
"title": "01.C++概述",
"path": [
"01.C++技术强化及提升",
"01.C++概述"
]
},
{
"id": "58954438",
"title": "02.C++初识",
"path": [
"01.C++技术强化及提升",
"02.C++初识"
]
},
{
"id": "58954439",
"title": "03.C++对C的扩展",
"path": [
"01.C++技术强化及提升",
"03.C++对C的扩展"
]
},
{
"id": "58954440",
"title": "04.类和对象",
"path": [
"01.C++技术强化及提升",
"04.类和对象"
]
},
{
"id": "58954448",
"title": "01.类和对象的基本概念",
"path": [
"01.C++技术强化及提升",
"04.类和对象",
"01.类和对象的基本概念"
]
},
{
"id": "58954449",
"title": "02.面向对象程序设计案例",
"path": [
"01.C++技术强化及提升",
"04.类和对象",
"02.面向对象程序设计案例"
]
},
{
"id": "58954451",
"title": "03.对象的构造和析构",
"path": [
"01.C++技术强化及提升",
"04.类和对象",
"03.对象的构造和析构"
]
},
{
"id": "58954456",
"title": "04.C++面向对象模型初探",
"path": [
"01.C++技术强化及提升",
"04.类和对象",
"04.C++面向对象模型初探"
]
},
{
"id": "58954457",
"title": "05.友元",
"path": [
"01.C++技术强化及提升",
"04.类和对象",
"05.友元"
]
},
{
"id": "58954458",
"title": "06.运算符重载",
"path": [
"01.C++技术强化及提升",
"04.类和对象",
"06.运算符重载"
]
},
{
"id": "58954461",
"title": "07.继承和派生",
"path": [
"01.C++技术强化及提升",
"04.类和对象",
"07.继承和派生"
]
},
{
"id": "58954469",
"title": "08.多态",
"path": [
"01.C++技术强化及提升",
"04.类和对象",
"08.多态"
]
},
{
"id": "58954472",
"title": "05.C++模板",
"path": [
"01.C++技术强化及提升",
"05.C++模板"
]
},
{
"id": "58954473",
"title": "06.C++类型转换",
"path": [
"01.C++技术强化及提升",
"06.C++类型转换"
]
},
{
"id": "58954474",
"title": "07.C++异常",
"path": [
"01.C++技术强化及提升",
"07.C++异常"
]
},
{
"id": "58954476",
"title": "08.C++输入输出流",
"path": [
"01.C++技术强化及提升",
"08.C++输入输出流"
]
},
{
"id": "58954485",
"title": "09.STL",
"path": [
"01.C++技术强化及提升",
"09.STL"
]
},
{
"id": "58954486",
"title": "01.STL概论",
"path": [
"01.C++技术强化及提升",
"09.STL",
"01.STL概论"
]
},
{
"id": "58954487",
"title": "02.STL三大组件",
"path": [
"01.C++技术强化及提升",
"09.STL",
"02.STL三大组件"
]
},
{
"id": "58954488",
"title": "03.常用容器",
"path": [
"01.C++技术强化及提升",
"09.STL",
"03.常用容器"
]
},
{
"id": "58954498",
"title": "04.常用算法",
"path": [
"01.C++技术强化及提升",
"09.STL",
"04.常用算法"
]
},
{
"id": "58954500",
"title": "02.QT安装教程(免注册和登陆)",
"path": [
"02.QT安装教程(免注册和登陆)"
]
},
{
"id": "58954512",
"title": "03.Qt桌面应用开发",
"path": [
"03.Qt桌面应用开发"
]
},
{
"id": "58954513",
"title": "1 Qt概述",
"path": [
"03.Qt桌面应用开发",
"1 Qt概述"
]
},
{
"id": "58954515",
"title": "2 创建Qt项目",
"path": [
"03.Qt桌面应用开发",
"2 创建Qt项目"
]
},
{
"id": "58954525",
"title": "3 第一个Qt小程序",
"path": [
"03.Qt桌面应用开发",
"3 第一个Qt小程序"
]
},
{
"id": "58954527",
"title": "4 信号和槽机制",
"path": [
"03.Qt桌面应用开发",
"4 信号和槽机制"
]
},
{
"id": "58954529",
"title": "5 QMainWindow",
"path": [
"03.Qt桌面应用开发",
"5 QMainWindow"
]
},
{
"id": "58954535",
"title": "6 对话框QDialog",
"path": [
"03.Qt桌面应用开发",
"6 对话框QDialog"
]
},
{
"id": "58954536",
"title": "7 布局管理器",
"path": [
"03.Qt桌面应用开发",
"7 布局管理器"
]
},
{
"id": "58954540",
"title": "8 常用控件",
"path": [
"03.Qt桌面应用开发",
"8 常用控件"
]
},
{
"id": "58954546",
"title": "9 Qt消息机制和事件",
"path": [
"03.Qt桌面应用开发",
"9 Qt消息机制和事件"
]
},
{
"id": "58954548",
"title": "10 绘图和绘图设备",
"path": [
"03.Qt桌面应用开发",
"10 绘图和绘图设备"
]
},
{
"id": "58954552",
"title": "11 文件系统",
"path": [
"03.Qt桌面应用开发",
"11 文件系统"
]
}
]
+1
View File
@@ -0,0 +1 @@
{"id":"58954436","type":"page","status":"current","title":"01.C++技术强化及提升","version":{"by":{"type":"known","username":"ethanliu","userKey":"2c90931b6cfb654f016d5c69becc0001","profilePicture":{"path":"/images/icons/profilepics/default.svg","width":48,"height":48,"isDefault":true},"displayName":"刘浩","_links":{"self":"https://wiki.suncaper.net/rest/api/user?key=2c90931b6cfb654f016d5c69becc0001"},"_expandable":{"status":""}},"when":"2022-07-09T01:51:24.000Z","message":"","number":1,"minorEdit":false,"hidden":false,"_links":{"self":"https://wiki.suncaper.net/rest/experimental/content/58954436/version/1"},"_expandable":{"content":"/rest/api/content/58954436"}},"body":{"storage":{"value":"","representation":"storage","_expandable":{"content":"/rest/api/content/58954436"}},"_expandable":{"editor":"","view":"","export_view":"","styled_view":"","anonymous_export_view":""}},"extensions":{"position":0},"_links":{"webui":"/pages/viewpage.action?pageId=58954436","edit":"/pages/resumedraft.action?draftId=58954436","tinyui":"/x/xJKDAw","collection":"/rest/api/content","base":"https://wiki.suncaper.net","context":"","self":"https://wiki.suncaper.net/rest/api/content/58954436"},"_expandable":{"container":"/rest/api/space/2CT","metadata":"","operations":"","children":"/rest/api/content/58954436/child","restrictions":"/rest/api/content/58954436/restriction/byOperation","history":"/rest/api/content/58954436/history","ancestors":"","descendants":"/rest/api/content/58954436/descendant","space":"/rest/api/space/2CT"}}
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1
View File
@@ -0,0 +1 @@
{"id":"58954440","type":"page","status":"current","title":"04.类和对象","version":{"by":{"type":"known","username":"ethanliu","userKey":"2c90931b6cfb654f016d5c69becc0001","profilePicture":{"path":"/images/icons/profilepics/default.svg","width":48,"height":48,"isDefault":true},"displayName":"刘浩","_links":{"self":"https://wiki.suncaper.net/rest/api/user?key=2c90931b6cfb654f016d5c69becc0001"},"_expandable":{"status":""}},"when":"2022-07-09T01:51:24.000Z","message":"","number":1,"minorEdit":false,"hidden":false,"_links":{"self":"https://wiki.suncaper.net/rest/experimental/content/58954440/version/1"},"_expandable":{"content":"/rest/api/content/58954440"}},"body":{"storage":{"value":"<ac:layout><ac:layout-section ac:type=\"two_right_sidebar\"><ac:layout-cell><p><ac:link><ri:page ri:content-title=\"01.类和对象的基本概念\" /></ac:link></p><p><ac:link><ri:page ri:content-title=\"02.面向对象程序设计案例\" /></ac:link></p><p><ac:link><ri:page ri:content-title=\"03.对象的构造和析构\" /></ac:link></p><p><ac:link><ri:page ri:content-title=\"04.C++面向对象模型初探\" /></ac:link></p><p><ac:link><ri:page ri:content-title=\"05.友元\" /></ac:link></p><p><ac:link><ri:page ri:content-title=\"06.运算符重载\" /></ac:link></p><p><ac:link><ri:page ri:content-title=\"07.继承和派生\" /></ac:link></p><p><ac:link><ri:page ri:content-title=\"08.多态\" /></ac:link></p></ac:layout-cell><ac:layout-cell><p><br /></p></ac:layout-cell></ac:layout-section></ac:layout>","representation":"storage","_expandable":{"content":"/rest/api/content/58954440"}},"_expandable":{"editor":"","view":"","export_view":"","styled_view":"","anonymous_export_view":""}},"extensions":{"position":"none"},"_links":{"webui":"/pages/viewpage.action?pageId=58954440","edit":"/pages/resumedraft.action?draftId=58954440","tinyui":"/x/yJKDAw","collection":"/rest/api/content","base":"https://wiki.suncaper.net","context":"","self":"https://wiki.suncaper.net/rest/api/content/58954440"},"_expandable":{"container":"/rest/api/space/2CT","metadata":"","operations":"","children":"/rest/api/content/58954440/child","restrictions":"/rest/api/content/58954440/restriction/byOperation","history":"/rest/api/content/58954440/history","ancestors":"","descendants":"/rest/api/content/58954440/descendant","space":"/rest/api/space/2CT"}}
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1
View File
@@ -0,0 +1 @@
{"id":"58954485","type":"page","status":"current","title":"09.STL","version":{"by":{"type":"known","username":"ethanliu","userKey":"2c90931b6cfb654f016d5c69becc0001","profilePicture":{"path":"/images/icons/profilepics/default.svg","width":48,"height":48,"isDefault":true},"displayName":"刘浩","_links":{"self":"https://wiki.suncaper.net/rest/api/user?key=2c90931b6cfb654f016d5c69becc0001"},"_expandable":{"status":""}},"when":"2022-07-09T01:51:24.000Z","message":"","number":1,"minorEdit":false,"hidden":false,"_links":{"self":"https://wiki.suncaper.net/rest/experimental/content/58954485/version/1"},"_expandable":{"content":"/rest/api/content/58954485"}},"body":{"storage":{"value":"","representation":"storage","_expandable":{"content":"/rest/api/content/58954485"}},"_expandable":{"editor":"","view":"","export_view":"","styled_view":"","anonymous_export_view":""}},"extensions":{"position":"none"},"_links":{"webui":"/display/2CT/09.STL","edit":"/pages/resumedraft.action?draftId=58954485","tinyui":"/x/9ZKDAw","collection":"/rest/api/content","base":"https://wiki.suncaper.net","context":"","self":"https://wiki.suncaper.net/rest/api/content/58954485"},"_expandable":{"container":"/rest/api/space/2CT","metadata":"","operations":"","children":"/rest/api/content/58954485/child","restrictions":"/rest/api/content/58954485/restriction/byOperation","history":"/rest/api/content/58954485/history","ancestors":"","descendants":"/rest/api/content/58954485/descendant","space":"/rest/api/space/2CT"}}
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1
View File
@@ -0,0 +1 @@
{"id":"58954536","type":"page","status":"current","title":"7 布局管理器","version":{"by":{"type":"known","username":"ethanliu","userKey":"2c90931b6cfb654f016d5c69becc0001","profilePicture":{"path":"/images/icons/profilepics/default.svg","width":48,"height":48,"isDefault":true},"displayName":"刘浩","_links":{"self":"https://wiki.suncaper.net/rest/api/user?key=2c90931b6cfb654f016d5c69becc0001"},"_expandable":{"status":""}},"when":"2022-07-09T01:51:25.000Z","message":"","number":1,"minorEdit":false,"hidden":false,"_links":{"self":"https://wiki.suncaper.net/rest/experimental/content/58954536/version/1"},"_expandable":{"content":"/rest/api/content/58954536"}},"body":{"storage":{"value":"<p>所谓 GUI 界面,归根结底,就是一堆组件的叠加。我们创建一个窗口,把按钮放上面,把图标放上面,这样就成了一个界面。在放置时,组件的位置尤其重要。我们必须要指定组件放在哪里,以便窗口能够按照我们需要的方式进行渲染。这就涉及到组件定位的机制。<br />\n<span style=\"color: rgb(255,0,0);\"><strong>Qt 提供了两种组件定位机制:绝对定位和布局定位。</strong></span></p>\n<ul>\n\t<li>绝对定位就是一种最原始的定位方法:给出这个组件的坐标和长宽值。</li>\n</ul>\n\n\n<p>这样,Qt 就知道该把组件放在哪里以及如何设置组件的大小。但是这样做带来的一个问题是,如果用户改变了窗口大小,比如点击最大化按钮或者使用鼠标拖动窗口边缘,采用绝对定位的组件是不会有任何响应的。这也很自然,因为你并没有告诉 Qt,在窗口变化时,组件是否要更新自己以及如何更新。或者,还有更简单的方法:禁止用户改变窗口大小。但这总不是长远之计。</p>\n<ul>\n\t<li>布局定位:你只要把组件放入某一种布局,布局由专门的布局管理器进行管理。当需要调整大小或者位置的时候,Qt 使用对应的布局管理器进行调整。</li>\n</ul>\n\n\n<p>布局定位完美的解决了使用绝对定位的缺陷。<br />\nQt 提供的布局中以下三种是我们最常用的:</p>\n<ul>\n\t<li>QHBoxLayout:按照水平方向从左到右布局;</li>\n\t<li>QVBoxLayout:按照竖直方向从上到下布局;</li>\n\t<li>QGridLayout:在一个网格中进行布局,类似于 HTML 的 table</li>\n</ul>\n\n\n<h1><ac:structured-macro ac:name=\"anchor\" ac:schema-version=\"1\" ac:macro-id=\"77a21336-b4b5-4b2a-84b6-80a32d528bfb\"><ac:parameter ac:name=\"\">_Toc466556793</ac:parameter></ac:structured-macro><ac:structured-macro ac:name=\"anchor\" ac:schema-version=\"1\" ac:macro-id=\"2abb1215-0dcc-4e38-b622-dc51eacb0597\"><ac:parameter ac:name=\"\">_Toc471842018</ac:parameter></ac:structured-macro>7.1 系统提供的布局控件</h1>\n<p><ac:image ac:height=\"156\" ac:width=\"298\"><ri:attachment ri:filename=\"worddav18ab88afaab13e557090ff7c7f4b8ce0.png\" /></ac:image><br />\n这4个为系统给我们提供的布局的控件,但是使用起来不是非常的灵活,这里就不详细介绍了。</p>\n<h1><ac:structured-macro ac:name=\"anchor\" ac:schema-version=\"1\" ac:macro-id=\"1a671ec2-4963-41a8-a244-1e245b4cab55\"><ac:parameter ac:name=\"\">_Toc471842019</ac:parameter></ac:structured-macro>7.2 利用widget做布局</h1>\n<p>第二种布局方式是利用控件里的widget来做布局,在Containers中<br />\n<ac:image ac:height=\"320\" ac:width=\"279\"><ri:attachment ri:filename=\"worddavb1b05c61db9303f4bd40ca5a09e9f386.png\" /></ac:image><br />\n在widget中的控件可以进行水平、垂直、栅格布局等操作,比较灵活。<br />\n再布局的同时我们需要灵活运用弹簧的特性让我们的布局更加的美观,下面是一个登陆窗口,利用widget可以搭建出如下登陆界面:<br />\n<ac:image ac:height=\"249\" ac:width=\"320\"><ri:attachment ri:filename=\"worddav726822fbe1bdfb789e8987a25380efa3.png\" /></ac:image></p>","representation":"storage","_expandable":{"content":"/rest/api/content/58954536"}},"_expandable":{"editor":"","view":"","export_view":"","styled_view":"","anonymous_export_view":""}},"extensions":{"position":44},"_links":{"webui":"/pages/viewpage.action?pageId=58954536","edit":"/pages/resumedraft.action?draftId=58954536","tinyui":"/x/KJODAw","collection":"/rest/api/content","base":"https://wiki.suncaper.net","context":"","self":"https://wiki.suncaper.net/rest/api/content/58954536"},"_expandable":{"container":"/rest/api/space/2CT","metadata":"","operations":"","children":"/rest/api/content/58954536/child","restrictions":"/rest/api/content/58954536/restriction/byOperation","history":"/rest/api/content/58954536/history","ancestors":"","descendants":"/rest/api/content/58954536/descendant","space":"/rest/api/space/2CT"}}
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+185
View File
@@ -0,0 +1,185 @@
{
"id": "58954499",
"title": "02.Qt方向",
"children": [
{
"id": "58954436",
"title": "01.C++技术强化及提升",
"children": [
{
"id": "58954437",
"title": "01.C++概述",
"children": []
},
{
"id": "58954438",
"title": "02.C++初识",
"children": []
},
{
"id": "58954439",
"title": "03.C++对C的扩展",
"children": []
},
{
"id": "58954440",
"title": "04.类和对象",
"children": [
{
"id": "58954448",
"title": "01.类和对象的基本概念",
"children": []
},
{
"id": "58954449",
"title": "02.面向对象程序设计案例",
"children": []
},
{
"id": "58954451",
"title": "03.对象的构造和析构",
"children": []
},
{
"id": "58954456",
"title": "04.C++面向对象模型初探",
"children": []
},
{
"id": "58954457",
"title": "05.友元",
"children": []
},
{
"id": "58954458",
"title": "06.运算符重载",
"children": []
},
{
"id": "58954461",
"title": "07.继承和派生",
"children": []
},
{
"id": "58954469",
"title": "08.多态",
"children": []
}
]
},
{
"id": "58954472",
"title": "05.C++模板",
"children": []
},
{
"id": "58954473",
"title": "06.C++类型转换",
"children": []
},
{
"id": "58954474",
"title": "07.C++异常",
"children": []
},
{
"id": "58954476",
"title": "08.C++输入输出流",
"children": []
},
{
"id": "58954485",
"title": "09.STL",
"children": [
{
"id": "58954486",
"title": "01.STL概论",
"children": []
},
{
"id": "58954487",
"title": "02.STL三大组件",
"children": []
},
{
"id": "58954488",
"title": "03.常用容器",
"children": []
},
{
"id": "58954498",
"title": "04.常用算法",
"children": []
}
]
}
]
},
{
"id": "58954500",
"title": "02.QT安装教程(免注册和登陆)",
"children": []
},
{
"id": "58954512",
"title": "03.Qt桌面应用开发",
"children": [
{
"id": "58954513",
"title": "1 Qt概述",
"children": []
},
{
"id": "58954515",
"title": "2 创建Qt项目",
"children": []
},
{
"id": "58954525",
"title": "3 第一个Qt小程序",
"children": []
},
{
"id": "58954527",
"title": "4 信号和槽机制",
"children": []
},
{
"id": "58954529",
"title": "5 QMainWindow",
"children": []
},
{
"id": "58954535",
"title": "6 对话框QDialog",
"children": []
},
{
"id": "58954536",
"title": "7 布局管理器",
"children": []
},
{
"id": "58954540",
"title": "8 常用控件",
"children": []
},
{
"id": "58954546",
"title": "9 Qt消息机制和事件",
"children": []
},
{
"id": "58954548",
"title": "10 绘图和绘图设备",
"children": []
},
{
"id": "58954552",
"title": "11 文件系统",
"children": []
}
]
}
]
}