From 0cb1544654e9da880a5092674ca71411fb680f8e Mon Sep 17 00:00:00 2001 From: ila Date: Wed, 17 Jun 2026 09:05:47 +0800 Subject: [PATCH] refactor: drop the duplicate in-app title bar; use the OS window title MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The in-content header strip showed the app name + version, duplicating the OS window title (setWindowTitle). With the 设置 button already gone it had no other purpose, so remove it (and its styles / unused _HEADER_HEIGHT). Name and version stay visible via the OS title bar; the work area gains ~40px. Docs: UI design 3 (layout) and 4.1 (title bar), tasks.md 17.7. Co-Authored-By: Claude Opus 4.8 --- docs/07-ui-design.md | 16 ++++----------- src/app/main_window.py | 45 +++--------------------------------------- tasks.md | 20 ++++++++++++++++++- 3 files changed, 26 insertions(+), 55 deletions(-) diff --git a/docs/07-ui-design.md b/docs/07-ui-design.md index 7a15295..3fe5e75 100644 --- a/docs/07-ui-design.md +++ b/docs/07-ui-design.md @@ -17,10 +17,9 @@ ## 3. 整体布局 -主窗口采用固定工具型布局: +主窗口采用固定工具型布局(软件名称与版本号由系统窗口标题栏显示,内容区不再单设标题栏): ```text -标题栏 流程页签 主工作区:左侧素材栏 | 中间预览区 | 右侧参数栏 底部合成队列 @@ -47,20 +46,13 @@ ### 4.1 标题栏 -内容: - -- 软件图标。 -- 软件名称:`自动合成印花服饰效果图工具`。 -- 当前版本号,放在软件名称右侧,例如:`v1.0.0`。 -- Windows 窗口按钮。 +直接使用系统(Windows)窗口标题栏显示软件名称与版本号(通过窗口标题设置,例如 `自动合成印花服饰效果图工具 v1.0.0`),不在内容区另画一条标题栏。 要求: -- 标题栏高度紧凑。 -- 版本号使用低于软件名称的视觉层级,例如浅灰小字。 -- 版本号必须常驻显示,便于用户和管理员确认当前运行版本。 +- 软件名称与版本号通过窗口标题常驻显示,便于用户和管理员确认当前运行版本。 +- 不在窗口内容区重复软件名称与版本号——内容区自绘标题栏会与系统标题栏重复,故不设置(除非后续改为无边框窗口、由自绘标题栏取代系统标题栏)。 - 暂不提供「设置」入口:当前可配置项不多,且输出目录/格式/质量在导出面板就地可改。待确有集中设置需求时再加,避免放置点了无反应的占位按钮。 -- 不放复杂业务按钮。 ### 4.2 流程页签 diff --git a/src/app/main_window.py b/src/app/main_window.py index 59147e9..4230a1f 100644 --- a/src/app/main_window.py +++ b/src/app/main_window.py @@ -29,7 +29,6 @@ logger = logging.getLogger(__name__) _LEFT_WIDTH = 374 _RIGHT_WIDTH = 318 _QUEUE_HEIGHT = 188 -_HEADER_HEIGHT = 40 _TABBAR_HEIGHT = 34 @@ -60,7 +59,9 @@ class MainWindow(QMainWindow): layout.setContentsMargins(0, 0, 0, 0) layout.setSpacing(0) - layout.addWidget(self._create_header()) + # No in-app title bar: the OS window title (setWindowTitle) already + # shows the app name and version, so an in-content header would just + # duplicate it. Start straight from the workflow tab bar. layout.addWidget(self._create_tab_bar()) layout.addWidget(self._create_work_area(), stretch=1) layout.addWidget(self._create_queue_panel()) @@ -70,29 +71,6 @@ class MainWindow(QMainWindow): self._connect_signals() self._restore_preferences() - def _create_header(self): - """Top header: app name and version label.""" - header = QWidget() - header.setObjectName("header") - header.setFixedHeight(_HEADER_HEIGHT) - - row = QHBoxLayout(header) - row.setContentsMargins(12, 0, 12, 0) - row.setSpacing(6) - - title = QLabel(APP_NAME) - title.setObjectName("appTitle") - - version = QLabel("v{}".format(APP_VERSION)) - version.setObjectName("appVersion") - version.setAlignment(Qt.AlignVCenter) - - row.addWidget(title) - row.addWidget(version) - row.addStretch() - - return header - def _create_tab_bar(self): """Workflow step selector (QTabBar only — no swappable pane).""" container = QWidget() @@ -458,23 +436,6 @@ class MainWindow(QMainWindow): background-color: #f0f0f0; } - /* Header */ - #header { - background-color: #ffffff; - border-bottom: 1px solid #d6d6d6; - } - #appTitle { - font-family: "Microsoft YaHei", "Segoe UI", sans-serif; - font-size: 14px; - font-weight: bold; - color: #1a1a1a; - } - #appVersion { - font-family: "Microsoft YaHei", "Segoe UI", sans-serif; - font-size: 11px; - color: #888888; - } - /* Flow tab bar */ #tabBarContainer { background-color: #f0f0f0; diff --git a/tasks.md b/tasks.md index 3d25501..dbde080 100644 --- a/tasks.md +++ b/tasks.md @@ -297,7 +297,7 @@ - [x] 先读取 `src/app/main_window.py` 现有内容 - [x] 将 `src/app/main_window.py` 从最小窗口扩展为主布局 -- [x] 实现顶部标题和版本号 +- [x] ~~实现顶部标题和版本号~~(后移除内容区自绘标题栏:与系统窗口标题重复,名称/版本改由系统标题栏显示,见 17.7) - [x] 实现流程页签区域 - [x] 实现左侧素材栏容器 - [x] 实现中间预览区容器 @@ -668,6 +668,24 @@ - [ ] 拖动/缩放预览后输入框仍正常同步 - [ ] 质量仍仅在 JPG 时可用 +### 17.7 移除重复的自绘标题栏与无效「设置」按钮 + +前置阅读: + +- `docs/07-ui-design.md`(3 整体布局、4.1 标题栏) + +任务: + +- [x] 移除标题栏里点了无反应的占位「设置」按钮 +- [x] 移除内容区自绘标题栏(与系统窗口标题重复),名称/版本由系统标题栏(`setWindowTitle`)显示 +- [x] 同步清理相关样式与未用常量 + +验收: + +- [x] 界面不再出现重复的软件名称/版本号 +- [x] 系统窗口标题仍显示 `APP_NAME` 与 `APP_VERSION` +- [x] 工作区因移除标题栏而获得更多纵向空间 + ## 18. 后续暂缓任务 以下任务第一阶段暂不做,后续需要时再新增设计文档: