Repository navigation
Conversation
Co-Authored-By: Claude Code <noreply@anthropic.com>
PinkMagicFly
force-pushed
the
da/6219/go_menu_widen_open_file
branch
from
October 16, 2026 11:05
f87deff to
a073829
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
任务简述
针对最近使用菜单过窄导致长文件名截断过多、以及缺乏直接打开本地文件入口的问题,完成最近使用菜单加宽与底部文件浏览器打开入口的开发,并修复了打开文件时 QML 弹层被提前销毁导致的崩溃。
改动内容
GoMenu.qml:
menuWidth由 260 调整至 360 逻辑像素(乘Theme.scaleFactor),长文件名可见字符显著增多;footerArea(含分隔细线与「打开文件…」菜单项),Flickable底部改锚定至footerArea.top,确保列表滚动时入口仍固定在底部;FolderIcon文件夹图标组件,MenuItem支持 action 模式(隐藏类型标签、展示文件夹图标),图标经统一Loader加载;goBridge.openFile()。GoMenuBridge (C++):
loadMeta按label_前缀通用解析文案字段(默认兜底qt_translate);Q_INVOKABLE void openFile():先hide()隐藏菜单,再以主窗口为父弹出系统QFileDialog::getOpenFileName,过滤器限定Documents (*.pdf *.tmu *.stem);;PDF (*.pdf);;TeXmacs (*.tmu);;STEM (*.stem);对话框返回后选中文件经loadBuffer(file)复用既有(go-menu-load-buffer ...)链路打开,取消则closeMenu();QPointer<QWidget>跟踪生命周期;MOGAN_TEST_OPEN_FILE环境变量钩子(cancel/event-loop-cancel/ 预设路径)以便自动化测试。崩溃修复(SIGABRT @ QQmlData::destroyed):
WA_DeleteOnClose,初版openFile()在弹原生对话框前先closeMenu(),对话框的嵌套事件循环会处理 DeferredDelete,使 QQuickWidget/QML 项在goBridge.openFile()的 QML 回调仍在调用栈时被销毁;Scheme 与翻译:
file-menu.scm:go-menu-meta增加(cons "label_open" (translate "Open file"));zh_CN.scm:增加("Open file" "打开文件")。单元测试:
go-menu-test.scm:增加label_open字段存在性断言;go_menu_bridge_test.cpp:默认 meta 含label_open、openFile调用,及event-loop-cancel生命周期回归用例(验证嵌套事件循环返回前菜单存活、返回后可正常延迟销毁);qml_load_test.cpp:GoMenuStubBridge增加label_open/openFile桩,断言menuWidth360 与恰好一个goMenuOpenItem。验证
xmake r go-menu-test:5 correct, 0 failedxmake r go_menu_bridge_test:5 passed, 0 failedxmake r qml_load_test:38 passed, 0 failedgf fmt --changed-since=main+ 全量gf fmt --check:通过🤖 Generated with Claude Code