Repository navigation
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideRestores the show-time toolbar layout recalculation so images loaded before display receive the correct width and consistently show navigation buttons and thumbnails. Sequence diagram for show-time toolbar geometry recalculationsequenceDiagram
participant ImageLoader
participant LibViewPanel
participant Toolbar
ImageLoader->>LibViewPanel: load image before show()
LibViewPanel->>LibViewPanel: showEvent(e)
LibViewPanel->>LibViewPanel: noAnimationBottomMove()
LibViewPanel->>LibViewPanel: resetBottomToolbarGeometry(currentWidget() == view)
LibViewPanel->>Toolbar: apply recalculated width
Toolbar-->>LibViewPanel: navigation buttons and thumbnails visible
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: Resurgamz The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
1. Root cause: resetBottomToolbarGeometry was commented out in showEvent, so toolbar width was not recomputed when the window became visible; slotOneImgReady updated menu content but also never triggered a toolbar re-layout, leaving thumbnails and prev/next buttons missing after async image load 2. Fix: restore resetBottomToolbarGeometry in showEvent and add the same call in slotOneImgReady so geometry is recomputed both on window show and on image-ready, covering both trigger paths 3. Impact: prev/next buttons and thumbnails now appear consistently when opening images; add temporary qInfo diagnostics tagged [BUG-376715] for FlemingX verification, removable after confirm Log: Fix missing prev/next buttons and thumbnails when opening images Influence: 1. Open images via double-click and drag-and-drop, verify toolbar buttons and thumbnails appear consistently 2. Repeat open/close 50+ times under high system load 3. Verify diagnostic logs output expected values on FlemingX fix: 显示与图片就绪时重算工具栏几何 1. 根因:showEvent 中 resetBottomToolbarGeometry 被注释,窗口显示时 未重算工具栏宽度;slotOneImgReady 仅更新菜单内容未触发工具栏 重布局,异步图片加载后缩略图与上一张/下一张按钮偶现缺失 2. 方案:恢复 showEvent 中的 resetBottomToolbarGeometry 调用,并在 slotOneImgReady 中补充同一调用,覆盖窗口显示与图片就绪两条触发路径 3. 影响:打开图片时上一张/下一张按钮与缩略图稳定显示;新增带 [BUG-376715] 标记的临时 qInfo 诊断日志供 FlemingX 验证,确认后可移除 Log: 修复打开图片时上一张/下一张按钮与缩略图偶现缺失 Influence: 1. 双击与拖拽方式打开图片,验证工具栏按钮与缩略图稳定显示 2. 高负载下重复打开关闭 50 次以上 3. 在 FlemingX 环境验证诊断日志输出符合预期 Bug: #376715
deepin pr auto review🤖 AI 代码审查报告📊 总体评价
🔍 详细分析1. 语法逻辑 ✅评价: 优秀 ✅ 通过 潜在问题: 建议: 语法正确,逻辑清晰。resetBottomToolbarGeometry(bool) 调用参数类型匹配(m_stack->currentWidget() == m_view 返回 bool),showEvent 与 slotOneImgReady 两条触发路径均覆盖,无明显语法或逻辑缺陷。 2. 代码质量 ✅评价: 良好 ✅ 通过 潜在问题:
建议: 1.FlemingX 验证完成后及时移除 [BUG-376715] 标记的临时 qInfo 诊断日志,或将 qInfo 降级为 qDebug 以避免污染生产日志 2.移除误提交的 commit-msg.txt 文件 3.代码结构清晰,注释完整,核心修复处已补充中文注释说明根因 3. 代码性能 ✅评价: 良好 ✅ 通过 潜在问题:
建议: 1.建议在 slotOneImgReady 中仅当 path 匹配 ItemInfo.path 时才调用 resetBottomToolbarGeometry,或增加防抖/脏标记避免冗余重布局 2.诊断日志移除后 UI 路径 I/O 开销即可消除 3.算法复杂度合理,无性能瓶颈 4. 代码安全 🔒评价: 优秀 ✅ 通过
安全漏洞详情: 建议: 安全合规。无用户输入注入、无硬编码密钥、无路径遍历、无命令注入风险。qInfo 日志输出的路径、尺寸、计数等信息为本地图片查看器非敏感数据。 💡 改进建议代码示例// slotOneImgReady: 仅在路径匹配时触发重布局,避免冗余计算
void LibViewPanel::slotOneImgReady(QString path, imageViewerSpace::ItemInfo itemInfo)
{
imageViewerSpace::ItemInfo ItemInfo = m_bottomToolbar->getCurrentItemInfo();
if (path.contains(ItemInfo.path)) {
updateMenuContent();
// 图片就绪后重算底部工具栏几何,覆盖缩略图内容不显示的独立根因
resetBottomToolbarGeometry(m_stack->currentWidget() == m_view);
}
Q_UNUSED(itemInfo);
}
// 验证完成后移除所有 [BUG-376715] 标记的临时 qInfo 诊断日志
// 并删除误提交的 commit-msg.txt 文件本报告由 AI 代码审查工具自动生成 |
Root Cause Analysis
When opening images in the image viewer, the prev/next navigation buttons and thumbnail bar occasionally fail to appear. The root cause is that toolbar geometry is not recalculated at the correct timing — two independent trigger paths lead to the same symptom:
resetBottomToolbarGeometrywas commented out inshowEvent(viewpanel.cpp:2204), so toolbar width was never recomputed when the window became visible. Under startup timing races whereslotDrogImgruns beforeshow(), the window dimensions are invalid and the toolbar geometry is wrong — this causes the prev/next buttons to go missing.slotOneImgReady(viewpanel.cpp:1996) only updates menu content but never triggers a toolbar re-layout. After async image loading completes, the thumbnail content is not displayed — this causes thumbnails to not show.Evidence:
resetBottomToolbarGeometrydepends onthis->width(), which is 0 beforeshow();slotOneImgReadyis signal-driven viaQt::QueuedConnectionwith no geometry re-layout call.Fix Approach
Two fixes, complementary coverage of the same root cause ("toolbar geometry not recalculated at the correct timing"):
showEvent— restoreresetBottomToolbarGeometryslotOneImgReady— addresetBottomToolbarGeometryBoth fixes call the same
resetBottomToolbarGeometrywith the samevisibleparameter pattern, ensuring toolbar geometry is recomputed on both the window-show and image-ready trigger paths.Additionally, 8 temporary
qInfodiagnostic logs tagged[BUG-376715]are added at key positions for FlemingX environment verification and to investigate whether candidates 3-6 (getToolbarWidth timing, estimatedDisplayCount stale width, button gating, QDir::entryInfoList filesystem behavior) are actually triggered.Diagnostic Log Handling
The 8
[BUG-376715]diagnostic logs are temporary, for verification purposes only. They are retained in this PR because FlemingX environment verification has not yet been completed — the logs are a necessary means to verify fix effectiveness and diagnose candidates 3-6. After FlemingX verification passes, these diagnostic logs must be removed in a separate commit.Change Safety Assessment
Code Safety
slotOneImgReadyis purely signal-driven (no direct callers), so the newresetBottomToolbarGeometrycall does not break any existing call chainresetBottomToolbarGeometryalready has 5 call sites; the 6th inslotOneImgReadyfollows the same pattern, and the function body is unchangedBusiness Impact Scope
resetBottomToolbarGeometrycall sites increase from 5 to 6; the newslotOneImgReadytrigger path uses the samevisibleparameter patternqInforead-only outputs with zero side effects, removable after verificationVerification Suggestion
paths.size,width/height, event trigger order) to confirm whether candidates 3-6 are actually triggered根因分析
看图打开图片时工具栏[上一张/下一张]按钮与缩略图偶现缺失。根因为工具栏几何未在正确时机重算——两条独立触发路径导致同一症状:
showEvent(viewpanel.cpp:2204)中resetBottomToolbarGeometry被注释,窗口显示后未重算工具栏宽度。在slotDrogImg先于show()执行的启动时序竞态下,窗口尺寸无效导致工具栏几何错误——导致上一张/下一张按钮缺失。slotOneImgReady(viewpanel.cpp:1996)仅更新菜单内容,图片就绪后不触发工具栏重布局,异步图片加载完成后缩略图内容不显示——导致缩略图不显示。证据:
resetBottomToolbarGeometry依赖this->width(),在show()前为 0;slotOneImgReady经Qt::QueuedConnection信号驱动,无几何重排调用。修复方案
两处修复,互补覆盖同一根因("工具栏几何未在正确时机重算"):
showEvent— 恢复resetBottomToolbarGeometryslotOneImgReady— 补充resetBottomToolbarGeometry两处修复调用同一
resetBottomToolbarGeometry,visible参数模式一致,确保窗口显示与图片就绪两条触发路径都会重算工具栏几何。同时添加 8 处带
[BUG-376715]标记的临时qInfo诊断日志,供 FlemingX 环境验证修复有效性并排查候选 3-6 是否实际触发。诊断日志处理
8 处
[BUG-376715]诊断日志为临时验证用途。因 FlemingX 环境验证尚未完成,日志是验证修复有效性的必要手段,故暂保留于本 PR。FlemingX 验证通过后,须在单独 commit 中移除这些诊断日志。改动安全评估
代码安全
slotOneImgReady纯信号驱动(无直接调用者),新增resetBottomToolbarGeometry调用不破坏任何现有调用链resetBottomToolbarGeometry已有 5 处调用点,slotOneImgReady中第 6 处遵循相同模式,函数内部逻辑未变业务影响范围
resetBottomToolbarGeometry调用点从 5 处增至 6 处,新增slotOneImgReady触发路径,visible参数模式一致qInfo只读输出,零副作用,验证通过后可移除getToolbarWidth时序、estimatedDisplayCount过期宽度、按钮门控、QDir::entryInfoList文件系统行为,待 FlemingX 诊断日志确认验证建议
paths.size、width/height、事件触发顺序,确认候选 3-6 是否实际触发Bug: #376715
后续跟踪项(候选 3-6):待 FlemingX 诊断日志结果决定是否处理。