Repository navigation
[6245] 默认大纲侧边栏宽度与模式工具栏分隔线对齐 - #4790
Merged
PinkMagicFly merged 2 commits intoNov 16, 2026
Merged
Conversation
PinkMagicFly
deleted the
pigmagicfly/6245/align-outline-toolbar-separator
branch
November 16, 2026 07:03
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.
What
打开文档显示左侧大纲侧边栏(
pdfOutlineDock)时,在默认状态下(未手动自定义宽度,或仅保留旧版自动写入的默认值300)使其右边缘与上方模式工具栏(modeToolBar)第一个垂直分隔线对齐。Why
300逻辑像素,而modeToolBar第一个垂直分隔线在不同平台/DPI 下的实际位置约为290~296逻辑像素,导致打开文档后大纲右边缘与上方分隔线错位。OutlineWidget::resizeEvent会在首次显示时自动将默认宽度300写入用户偏好"outline sidebar width",导致后续打开文档直接沿用旧默认值。How
src/Plugins/Qt/qt_pdf_outline_widget.hpp/.cpp:kOutlineDefaultWidth调整为290,新增OutlineWidget::defaultWidth()与OutlineWidget::separatorAlignWidth(QMainWindow*, QToolBar*)。OutlineWidget::applyDockWidth(QMainWindow*, int),在程序化调整 dock 宽度时抑制resizeEvent的偏好落盘,避免将默认对齐宽度误写为用户自定义偏好。src/Plugins/Qt/qt_tm_widget.cpp:has_custom_outline_width()区分用户真实自定义宽度与旧版自动写入的300。restore_outline_dock_width中优先对齐modeToolBar第一个可见分隔符中心横坐标,并在QTimer::singleShot(0, ...)与SLOT_MODE_ICONS刷新后补齐对齐。tests/Plugins/Qt/qt_outline_widget_test.cpp:test_separatorAlignWidth_and_defaultWidth单元测试。验证结果
gf fmt --changed-since=main:通过xmake b qt_outline_widget_test && xmake r qt_outline_widget_test:25 passed, 0 failedxmake build --yes stem && xmake install --yes stem:构建并安装成功