d3e2e50f0e
- 新增 mainwindow2.{h,cpp,ui}:用 Qt Designer 生成的第二套 QMainWindow 表单
(File/Edit/Help 菜单 + actionOpen/actionAbout_Me),供课堂对比「代码搭界面」
与「Designer 拖界面」两条路线。
- 新增子目录 CMakeLists.txt:供单独打开该示例构建(顶层 add_subdirectory 不递归,
与 lineedit_eye_toggle / mandelbrot_renderer 同模式)。
- mainwindow.ui / mainwindow.qrc:经 Designer 重新保存后的表单与资源清单维护
(iconset 去掉 resource= 显式引用、属性顺序由 Designer 重排)。
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
292 lines
8.3 KiB
XML
292 lines
8.3 KiB
XML
<?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>
|
||
<normaloff>:/icons/app.png</normaloff>:/icons/app.png</iconset>
|
||
</property>
|
||
<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>
|
||
<widget class="QMenuBar" name="menubar">
|
||
<property name="geometry">
|
||
<rect>
|
||
<x>0</x>
|
||
<y>0</y>
|
||
<width>720</width>
|
||
<height>21</height>
|
||
</rect>
|
||
</property>
|
||
<widget class="QMenu" name="menuFile">
|
||
<property name="title">
|
||
<string>文件(&F)</string>
|
||
</property>
|
||
<addaction name="actionNew"/>
|
||
<addaction name="actionQuit"/>
|
||
</widget>
|
||
<widget class="QMenu" name="menuView">
|
||
<property name="title">
|
||
<string>视图(&V)</string>
|
||
</property>
|
||
<widget class="QMenu" name="menuToolBarArea">
|
||
<property name="title">
|
||
<string>工具栏停靠区(&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>帮助(&H)</string>
|
||
</property>
|
||
<addaction name="actionAbout"/>
|
||
</widget>
|
||
<addaction name="menuFile"/>
|
||
<addaction name="menuView"/>
|
||
<addaction name="menuHelp"/>
|
||
</widget>
|
||
<widget class="QStatusBar" name="statusbar"/>
|
||
<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>
|
||
<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>我是浮动窗口(QDockWidget,5.4 铆接部件)。
|
||
可拖出浮动,也可停靠到主窗口边缘。
|
||
视图菜单的「停靠窗口浮动/停靠」可切换我的状态。</string>
|
||
</property>
|
||
<property name="wordWrap">
|
||
<bool>true</bool>
|
||
</property>
|
||
</widget>
|
||
</item>
|
||
</layout>
|
||
</widget>
|
||
</widget>
|
||
<action name="actionNew">
|
||
<property name="icon">
|
||
<iconset>
|
||
<normaloff>:/icons/new.png</normaloff>:/icons/new.png</iconset>
|
||
</property>
|
||
<property name="text">
|
||
<string>新建</string>
|
||
</property>
|
||
<property name="statusTip">
|
||
<string>清空编辑区(5.5 中心部件)</string>
|
||
</property>
|
||
<property name="shortcut">
|
||
<string>Ctrl+N</string>
|
||
</property>
|
||
</action>
|
||
<action name="actionQuit">
|
||
<property name="icon">
|
||
<iconset>
|
||
<normaloff>:/icons/quit.png</normaloff>:/icons/quit.png</iconset>
|
||
</property>
|
||
<property name="text">
|
||
<string>退出</string>
|
||
</property>
|
||
<property name="statusTip">
|
||
<string>退出程序</string>
|
||
</property>
|
||
<property name="shortcut">
|
||
<string>Ctrl+Q</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>
|
||
<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>
|
||
<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/>
|
||
<connections/>
|
||
</ui>
|