Files
scuc-qt-course/docs/teaching/examples/mainwindow_showcase/mainwindow.ui
T
张宗平 05a685c952 Day3 教学示例:增强版计算器接入 + QMainWindow/QSS 两版参考实现
- calculator_designer_ext(Day2 增强版:表达式求值 + 括号,递归下降解析器)接入 cmake
- calculator_mainwindow(Day3 上午):增强版计算器装进 QMainWindow,
  菜单/状态栏/历史停靠窗,纯代码 + 显式 connect,与 mainwindow_showcase 形成坑卡对照
- calculator_mainwindow_qss(Day3 下午):上午版 + QSS 双主题美化(按键分色/伪状态/深浅切换)
- 验证 mainwindow_showcase(QMainWindow 六大组件综合演示,.ui + .qrc)
- OUTLINE_4DAY.md / ASSIGNMENTS.md Day3 衔接增强版起点 + 参考实现指引
- 补提交 Day2 calculator/ 与 calculator_designer/ 参考实现(CMakeLists 已引用)
- 全量构建 28/28,4 目标离屏自测退出码 0

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-07 22:59:05 +08:00

300 lines
8.9 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>720</width>
<height>480</height>
</rect>
</property>
<property name="windowTitle">
<string>QMainWindow 教学综合示例</string>
</property>
<property name="windowIcon">
<iconset resource="mainwindow.qrc">
<normaloff>:/icons/app.png</normaloff>:/icons/app.png</iconset>
</property>
<!-- 5.5 中心部件:QTextEdit(编辑器主体) -->
<widget class="QWidget" name="centralwidget">
<layout class="QVBoxLayout" name="centralLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QTextEdit" name="textEdit">
<property name="plainText">
<string>欢迎使用 QMainWindow 教学综合示例。
在这里编辑文字,状态栏会实时显示光标行列与字数。
视图菜单可操控工具栏、状态栏与浮动窗口。</string>
</property>
</widget>
</item>
</layout>
</widget>
<!-- 5.1 菜单栏:文件 / 视图 / 帮助 -->
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>720</width>
<height>22</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">
<property name="title">
<string>文件(&amp;F)</string>
</property>
<addaction name="actionNew"/>
<addaction name="actionQuit"/>
</widget>
<widget class="QMenu" name="menuView">
<property name="title">
<string>视图(&amp;V)</string>
</property>
<widget class="QMenu" name="menuToolBarArea">
<property name="title">
<string>工具栏停靠区(&amp;A)</string>
</property>
<addaction name="actionToolBarAreaLeft"/>
<addaction name="actionToolBarAreaRight"/>
<addaction name="actionToolBarAreaTop"/>
<addaction name="actionToolBarAreaBottom"/>
<addaction name="actionToolBarAreaAll"/>
</widget>
<addaction name="actionToggleToolBar"/>
<addaction name="actionToggleStatusBar"/>
<addaction name="actionToggleToolBarMovable"/>
<addaction name="actionToggleDockFloating"/>
<addaction name="actionShowDock"/>
<addaction name="actionHideDock"/>
<addaction name="menuToolBarArea"/>
</widget>
<widget class="QMenu" name="menuHelp">
<property name="title">
<string>帮助(&amp;H)</string>
</property>
<addaction name="actionAbout"/>
</widget>
<addaction name="menuFile"/>
<addaction name="menuView"/>
<addaction name="menuHelp"/>
</widget>
<!-- 5.3 状态栏(.ui 占位,永久标签在 .cpp 用 addPermanentWidget 添加) -->
<widget class="QStatusBar" name="statusbar"/>
<!-- 5.2 工具栏:复用同一批 QAction(QAction 是菜单项与工具按钮的公共抽象) -->
<widget class="QToolBar" name="mainToolBar">
<property name="windowTitle">
<string>主工具栏</string>
</property>
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
<addaction name="actionNew"/>
<addaction name="actionQuit"/>
<addaction name="actionToggleDockFloating"/>
<addaction name="actionAbout"/>
</widget>
<!-- 5.4 铆接部件(浮动窗口):可拖出浮动、停靠到边缘 -->
<widget class="QDockWidget" name="dockWidget">
<property name="windowTitle">
<string>浮动窗口</string>
</property>
<attribute name="dockWidgetArea">
<number>1</number>
</attribute>
<widget class="QWidget" name="dockContent">
<layout class="QVBoxLayout" name="dockLayout">
<item>
<widget class="QLabel" name="dockLabel">
<property name="text">
<string>我是浮动窗口(QDockWidget5.4 铆接部件)。
可拖出浮动,也可停靠到主窗口边缘。
视图菜单的「停靠窗口浮动/停靠」可切换我的状态。</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
<!-- 5.1 QAction:菜单项与工具按钮的公共抽象。图标取自 5.6 资源文件 -->
<action name="actionNew">
<property name="icon">
<iconset resource="mainwindow.qrc">
<normaloff>:/icons/new.png</normaloff>:/icons/new.png</iconset>
</property>
<property name="text">
<string>新建</string>
</property>
<property name="shortcut">
<string>Ctrl+N</string>
</property>
<property name="statusTip">
<string>清空编辑区(5.5 中心部件)</string>
</property>
</action>
<action name="actionQuit">
<property name="icon">
<iconset resource="mainwindow.qrc">
<normaloff>:/icons/quit.png</normaloff>:/icons/quit.png</iconset>
</property>
<property name="text">
<string>退出</string>
</property>
<property name="shortcut">
<string>Ctrl+Q</string>
</property>
<property name="statusTip">
<string>退出程序</string>
</property>
</action>
<action name="actionToggleToolBar">
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="text">
<string>显示主工具栏</string>
</property>
<property name="statusTip">
<string>显示或隐藏主工具栏(5.2 工具栏)</string>
</property>
</action>
<action name="actionToggleStatusBar">
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="text">
<string>显示状态栏</string>
</property>
<property name="statusTip">
<string>显示或隐藏状态栏(5.3 状态栏)</string>
</property>
</action>
<action name="actionToggleToolBarMovable">
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="text">
<string>工具栏可移动</string>
</property>
<property name="statusTip">
<string>切换工具栏是否可拖动(5.2 setMovable</string>
</property>
</action>
<action name="actionToggleDockFloating">
<property name="icon">
<iconset resource="mainwindow.qrc">
<normaloff>:/icons/dock.png</normaloff>:/icons/dock.png</iconset>
</property>
<property name="text">
<string>停靠窗口浮动/停靠</string>
</property>
<property name="statusTip">
<string>切换浮动窗口的浮动状态(5.4 setFloating</string>
</property>
</action>
<action name="actionShowDock">
<property name="text">
<string>显示浮动窗口</string>
</property>
<property name="statusTip">
<string>重新显示已关闭的浮动窗口(5.4 show)</string>
</property>
</action>
<action name="actionHideDock">
<property name="text">
<string>关闭浮动窗口</string>
</property>
<property name="statusTip">
<string>隐藏浮动窗口(5.4 hide</string>
</property>
</action>
<action name="actionToolBarAreaLeft">
<property name="text">
<string>停靠左侧</string>
</property>
<property name="statusTip">
<string>限制工具栏只能停靠左侧(5.2 setAllowedAreas</string>
</property>
</action>
<action name="actionToolBarAreaRight">
<property name="text">
<string>停靠右侧</string>
</property>
<property name="statusTip">
<string>限制工具栏只能停靠右侧</string>
</property>
</action>
<action name="actionToolBarAreaTop">
<property name="text">
<string>停靠顶部</string>
</property>
<property name="statusTip">
<string>限制工具栏只能停靠顶部</string>
</property>
</action>
<action name="actionToolBarAreaBottom">
<property name="text">
<string>停靠底部</string>
</property>
<property name="statusTip">
<string>限制工具栏只能停靠底部</string>
</property>
</action>
<action name="actionToolBarAreaAll">
<property name="text">
<string>允许全部区域</string>
</property>
<property name="statusTip">
<string>工具栏允许停靠在任意区域</string>
</property>
</action>
<action name="actionAbout">
<property name="icon">
<iconset resource="mainwindow.qrc">
<normaloff>:/icons/about.png</normaloff>:/icons/about.png</iconset>
</property>
<property name="text">
<string>关于</string>
</property>
<property name="statusTip">
<string>关于本程序</string>
</property>
</action>
</widget>
<resources>
<include location="mainwindow.qrc"/>
</resources>
<connections/>
</ui>