[0169] PDF阅读器在占据屏幕一半的时候,自动Fit Width#3526
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- 新增 maybeAutoFitWidth():当 widget 宽度不超过屏幕可用宽度一半时,自动调用 fitWidth() - 在 loadFromFile() 加载 PDF 后调用 maybeAutoFitWidth(),确保初始显示自动适应宽度 - 在 resize 防抖回调 onResizeDebounced() 中同样调用 maybeAutoFitWidth(),支持窗口从宽变窄时自动适应 - 引入 autoFitApplied_ 标志位,每个 PDF 加载周期内只自动触发一次,避免覆盖用户手动缩放 - 新增单元测试 test_autoFitWidth_whenNarrow 和 test_noAutoFitWidth_whenWide Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- maybeAutoFitWidth() 现在检测窗口是否真正贴靠到屏幕左/右边缘 - 排除最大化/全屏状态,避免手动缩小窗口误触发 - onResizeDebounced() 增加重置逻辑,离开半屏后可再次触发 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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.
Summary
fitWidth()loadFromFile()加载 PDF 后调用,确保初始显示自动适应宽度onResizeDebounced()中同样调用,支持窗口从宽变窄时自动适应autoFitApplied_标志位,每个 PDF 加载周期内只自动触发一次,避免覆盖用户手动缩放test_autoFitWidth_whenNarrow和test_noAutoFitWidth_whenWideTest plan
xmake b qt_pdf_reader_widget_test编译通过xmake r qt_pdf_reader_widget_test全部 41 个测试通过🤖 Generated with Claude Code