Skip to content

fix: restore resetBottomToolbarGeometry call in showEvent to fix toolbar missing - #182

Open
Resurgamz wants to merge 1 commit into
linuxdeepin:masterfrom
Resurgamz:master
Open

Resurgamz wants to merge 1 commit into
linuxdeepin:masterfrom
Resurgamz:master

Conversation

@Resurgamz

@Resurgamz Resurgamz commented Oct 13, 2026 •

Copy link
Copy Markdown

Root Cause Analysis

The resetBottomToolbarGeometry call in LibViewPanel::showEvent was commented out, causing the bottom toolbar width to not be recalculated when the window becomes visible. When images are loaded before show() is called (e.g., via drag-and-drop), the toolbar geometry is computed with an incorrect window size. Since showEvent does not recompute it, the prev/next buttons and thumbnails occasionally fail to appear.

Key evidence:

  • showEvent (viewpanel.cpp:2204): resetBottomToolbarGeometry commented out since initial commit
  • resizeEvent calls resetBottomToolbarGeometry but may not fire if window size doesn't change on show
  • slotOneImgReady updates menu content but does not trigger toolbar re-layout

Fix

Uncomment resetBottomToolbarGeometry(m_stack->currentWidget() == m_view); in showEvent so the toolbar width is recalculated when the window becomes visible.

Git blame confirms the comment existed from the initial commit (1fa9bc5, unrelated "printCount" fix) and was not an intentional fix for any specific issue. No subsequent commits touched this line.

Safety Assessment

  • Risk level: Low — restores a single function call that is already used elsewhere in the same file
  • No regression risk: the comment was not introduced to fix a specific bug
  • Business impact: affects toolbar/thumbnail display when opening images; fix ensures correct toolbar geometry on window show
  • Verification: open images via double-click and drag-and-drop, verify prev/next buttons and thumbnails appear consistently

Bug: https://pms.uniontech.com/bug-view-376715.html

Summary by Sourcery

Bug Fixes:

  • Restore bottom toolbar geometry recalculation when the view becomes visible, ensuring navigation buttons and thumbnails appear correctly when opening images.

…bar missing

The resetBottomToolbarGeometry call in LibViewPanel::showEvent was
commented out since the initial commit, causing the bottom toolbar
width to not be recalculated when the window becomes visible. This
resulted in prev/next buttons and thumbnails occasionally not showing
when opening images.

Git blame confirms the comment existed from the initial commit
(1fa9bc5, unrelated printCount fix) and was not an intentional fix
for any specific issue.

Log: Restore resetBottomToolbarGeometry in showEvent to recalculate toolbar width on window show
Bug: https://pms.uniontech.com/bug-view-376715.html
@sourcery-ai

sourcery-ai Bot commented Oct 13, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Restores 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 recalculation

sequenceDiagram
    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
Loading

File-Level Changes

Change Details Files
Restore bottom toolbar geometry recalculation when the view panel becomes visible.
  • Uncomment the existing geometry reset call in showEvent.
  • Recalculate using whether the current stacked widget is the main view, preserving the established toolbar state logic.
libimageviewer/viewpanel/viewpanel.cpp

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@deepin-ci-robot

Copy link
Copy Markdown

[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.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants