Skip to content

fix: align search count text with content in delegate - #440

Draft
GongHeng2017 wants to merge 1 commit into
linuxdeepin:masterfrom
GongHeng2017:agent/agent/baea83ed97e1
Draft

GongHeng2017 wants to merge 1 commit into
linuxdeepin:masterfrom
GongHeng2017:agent/agent/baea83ed97e1

Conversation

@GongHeng2017

@GongHeng2017 GongHeng2017 commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

fix: align search count text with content in delegate

  1. Root cause: SearchResDelegate::paint() calculated search count
    text x-position with a hardcoded -20 right margin, while content
    text and bottom line used option.rect.right() directly (0px margin)
  2. Fix: remove the -20 offset so search count text right edge aligns
    with content text and bottom line right edge
  3. Impact: only affects search result sidebar item rendering; no
    signature change, no effect on other delegates or widgets

Log: fix search count text right margin misalignment in sidebar

Influence:

  1. Test search result list items show count text aligned with content
  2. Test alignment under different window widths
  3. Verify no regression in dark/light theme rendering

fix: 修复搜索结果侧栏数量文本与内容文本右边界不对齐

  1. 根因:SearchResDelegate::paint() 计算搜索数量文本 x 坐标时使用了
    硬编码 -20 右边距,而内容文本和底线直接使用 option.rect.right()
    (0px 右边距),导致不对齐 20px
  2. 方案:移除 -20 偏移,使搜索数量文本右边界与内容文本及底线右边界对齐
  3. 影响:仅影响搜索结果侧栏列表项渲染,不改变函数签名,不影响其他
    delegate 或 widget

Log: 修复搜索结果侧栏数量文本右边距不对齐问题

Influence:

  1. 测试搜索结果列表项中数量文本与内容文本右边界对齐
  2. 测试不同窗口宽度下的对齐表现
  3. 验证深色/浅色主题下渲染无回归

PMS: BUG-193245

Summary by Sourcery

Bug Fixes:

  • Align search result count text with the content text and bottom-line right edge in sidebar items.

1. Root cause: SearchResDelegate::paint() calculated search count
   text x-position with a hardcoded -20 right margin, while content
   text and bottom line used option.rect.right() directly (0px margin)
2. Fix: remove the -20 offset so search count text right edge aligns
   with content text and bottom line right edge
3. Impact: only affects search result sidebar item rendering; no
   signature change, no effect on other delegates or widgets

Log: fix search count text right margin misalignment in sidebar

Influence:
1. Test search result list items show count text aligned with content
2. Test alignment under different window widths
3. Verify no regression in dark/light theme rendering

fix: 修复搜索结果侧栏数量文本与内容文本右边界不对齐

1. 根因:SearchResDelegate::paint() 计算搜索数量文本 x 坐标时使用了
   硬编码 -20 右边距,而内容文本和底线直接使用 option.rect.right()
   (0px 右边距),导致不对齐 20px
2. 方案:移除 -20 偏移,使搜索数量文本右边界与内容文本及底线右边界对齐
3. 影响:仅影响搜索结果侧栏列表项渲染,不改变函数签名,不影响其他
   delegate 或 widget

Log: 修复搜索结果侧栏数量文本右边距不对齐问题

Influence:
1. 测试搜索结果列表项中数量文本与内容文本右边界对齐
2. 测试不同窗口宽度下的对齐表现
3. 验证深色/浅色主题下渲染无回归

PMS: BUG-193245
@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: GongHeng2017

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 commented Oct 29, 2026

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

Reviewer's Guide

This PR fixes a 20-pixel right-edge misalignment in search result sidebar items by removing the hardcoded offset from SearchResDelegate::paint(), while leaving other delegates, widgets, and public interfaces unaffected.

Flow diagram for aligned search result item rendering

flowchart LR
    A[SearchResDelegate::paint] --> B[Compute searchCountTextWidth]
    B --> C[drawText at option.rect.right minus searchCountTextWidth]
    C --> D[Search count right edge]
    E[Content text and bottom line] --> F[option.rect.right]
    D --> G[Aligned right edges]
    F --> G
Loading

File-Level Changes

Change Details Files
Correct the search count text’s horizontal placement so its right edge aligns with the content text and bottom line.
  • Removed the hardcoded 20-pixel subtraction from the search count text x-coordinate.
  • Kept the existing delegate API and rendering flow unchanged.
reader/sidebar/SearchResDelegate.cpp
Validate the rendering correction across supported layout and visual states.
  • Check alignment at different sidebar/window widths.
  • Verify light and dark theme rendering has no regressions.
reader/sidebar/SearchResDelegate.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

@GongHeng2017
GongHeng2017 marked this pull request as draft October 29, 2026 20:42

@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