fix: 主窗口位置、尺寸和最大化跨重启恢复(#33 D3) #39

Open
abaishu0730 wants to merge 1 commits from codex/issue33-d3 into main
pull from: codex/issue33-d3
Owner

Issue #33 D3 主窗口布局恢复

原来的 ui-layout.ini 只保存分栏、表头与排序,TrialTaskCenterWindow 每次启动都会重用默认窗口尺寸。复现时,保存进程关闭前的普通窗口为 (45, 55, 1200, 760) 且已最大化,重启后普通窗口变为 (2, 2, 1280, 880) 且未最大化。

正常接受关闭后,现通过 Qt saveGeometry() 持久化普通窗口几何和最大化状态。启动时调用 restoreGeometry()。若配置损坏、DPI 改变导致 Qt 拒绝恢复,或普通窗口超出当前可用屏幕,窗口会在当前可用屏幕内重新定位,并保留产品定义的最小尺寸。

Windows 原生窗口实测

$env:QT_QPA_PLATFORM = 'windows'
python -m pytest -q -s tests/v1_1/test_window_geometry.py
场景 结果
正常退出并启动新进程 普通窗口几何保持 (45, 55, 1200, 760),最大化状态保持为真
新进程设 QT_SCALE_FACTOR=1.5 普通窗口回退为 (8, 36, 1008, 700),窗口位于可用屏幕,采用普通状态
配置值为错误类型或截断的字节 窗口仍能打开,普通窗口位置可达
配置保存位置为 (50000, 50000) 窗口回到可用屏幕

测试通过 4 项。屏外场景用坐标模拟显示器移除,DPI 变化由 Qt 环境设置触发。

# Issue #33 D3 主窗口布局恢复 原来的 `ui-layout.ini` 只保存分栏、表头与排序,`TrialTaskCenterWindow` 每次启动都会重用默认窗口尺寸。复现时,保存进程关闭前的普通窗口为 `(45, 55, 1200, 760)` 且已最大化,重启后普通窗口变为 `(2, 2, 1280, 880)` 且未最大化。 正常接受关闭后,现通过 Qt `saveGeometry()` 持久化普通窗口几何和最大化状态。启动时调用 `restoreGeometry()`。若配置损坏、DPI 改变导致 Qt 拒绝恢复,或普通窗口超出当前可用屏幕,窗口会在当前可用屏幕内重新定位,并保留产品定义的最小尺寸。 ## Windows 原生窗口实测 ```powershell $env:QT_QPA_PLATFORM = 'windows' python -m pytest -q -s tests/v1_1/test_window_geometry.py ``` | 场景 | 结果 | | --- | --- | | 正常退出并启动新进程 | 普通窗口几何保持 `(45, 55, 1200, 760)`,最大化状态保持为真 | | 新进程设 `QT_SCALE_FACTOR=1.5` | 普通窗口回退为 `(8, 36, 1008, 700)`,窗口位于可用屏幕,采用普通状态 | | 配置值为错误类型或截断的字节 | 窗口仍能打开,普通窗口位置可达 | | 配置保存位置为 `(50000, 50000)` | 窗口回到可用屏幕 | 测试通过 4 项。屏外场景用坐标模拟显示器移除,DPI 变化由 Qt 环境设置触发。
abaishu0730 added 1 commit 2026-11-25 10:00:20 +08:00
fix: restore the main window geometry across sessions
Core regression / Python core, intervention UI and release configuration (push) Waiting to run
Core regression / JavaScript syntax (push) Waiting to run
Core regression / Python core, intervention UI and release configuration (pull_request) Waiting to run
Core regression / JavaScript syntax (pull_request) Waiting to run
650dfd5491
Some checks are pending
Core regression / Python core, intervention UI and release configuration (push) Waiting to run
Core regression / JavaScript syntax (push) Waiting to run
Core regression / Python core, intervention UI and release configuration (pull_request) Waiting to run
Core regression / JavaScript syntax (pull_request) Waiting to run
You are not authorized to merge this pull request.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin codex/issue33-d3:codex/issue33-d3
git checkout codex/issue33-d3
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Skyworth_Digital_Hardware/dxdesigner-part-replacement#39