Skip to content

fix: show scrollbar in file list views - #841

Draft
pppanghu77 wants to merge 1 commit into
linuxdeepin:release/v20from
pppanghu77:agent/agent/967075547759
Draft

pppanghu77 wants to merge 1 commit into
linuxdeepin:release/v20from
pppanghu77:agent/agent/967075547759

Conversation

@pppanghu77

@pppanghu77 pppanghu77 commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Root Cause Analysis

SelectListView constructor in item.cpp:727 explicitly sets setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff), permanently hiding the vertical scrollbar even when content overflows the viewport. The same pattern exists in createbackupfilewidget.cpp:256 for the disk list view. A minimal PyQt5 demo confirmed that ScrollBarAlwaysOff renders the scrollbar invisible while ScrollBarAsNeeded restores it — matching the PMS-reported symptom exactly.

Fix

Change the vertical scrollbar policy from ScrollBarAlwaysOff to ScrollBarAsNeeded in both item.cpp:727 and createbackupfilewidget.cpp:256, restoring the Qt default behavior where the scrollbar appears on demand.

Change Safety Assessment

Code Safety

  • Risk Level: Low
  • Both target lines are UI feature development artifacts (not prior bug fixes); pickaxe found no subsequent fix commits on these lines — this change does not revert any historical fix.
  • Only 2 lines changed; no function signature changes, no deleted public APIs, no member variable modifications.

Business Impact Scope

  • FileSelectWidget / AppSelectWidget / ConfigSelectWidget — file/app/config selection pages in data-transfer tool benefit from restored scrollbar when list content exceeds viewport.
  • CreateBackupFileWidget — disk selection list in backup creation view benefits from restored scrollbar.
  • No behavior change when content fits within the viewport (AsNeeded semantics).

Verification Suggestion

Test file browsing with more items than viewport height to confirm scrollbar visibility and drag functionality; verify scrollbar hidden when content fits viewport.


根因分析

SelectListView 构造函数(item.cpp:727)显式设置 setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff),永久隐藏垂直滚动条,即使内容超出视口。createbackupfilewidget.cpp:256 的磁盘列表视图存在相同问题。最小 PyQt5 demo 验证:ScrollBarAlwaysOff 下滚动条不可见,ScrollBarAsNeeded 下恢复正常——与 PMS 报告现象完全一致。

修复方案

将 item.cpp:727 和 createbackupfilewidget.cpp:256 的垂直滚动条策略从 ScrollBarAlwaysOff 改为 ScrollBarAsNeeded,恢复 Qt 默认的按需显示行为。

改动安全评估

代码安全评估

  • 风险等级: 低风险
  • 两处目标行均为 UI 功能开发产物(非历史 bug 修复),pickaxe 未发现后续针对该行的修复 commit——本次改动不撤销任何已有修复。
  • 仅改动 2 行,无函数签名变更、无公开 API 删除、无成员变量修改。

业务影响范围

  • 文件/应用/配置选择页面(FileSelectWidget/AppSelectWidget/ConfigSelectWidget) — 数据迁移工具中列表内容超出视口时滚动条恢复显示。
  • 备份文件选择(CreateBackupFileWidget) — 磁盘选择列表内容超出视口时滚动条恢复显示。
  • 内容未超出视口时无行为变化(AsNeeded 语义)。

验证建议

测试文件浏览页面文件数量超出视口时滚动条可见且可拖动;验证内容未超出视口时滚动条不显示。

Summary by Sourcery

Show vertical scrollbars on file selection lists only when their content overflows the available viewport.

Bug Fixes:

  • Restore on-demand vertical scrollbars in file, application, configuration, and disk selection lists when their content exceeds the viewport.

Chores:

  • Add SPDX copyright and license headers to the modified source files.

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: pppanghu77

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

Changes the vertical scrollbar policy from AlwaysOff to AsNeeded in the backup disk list and shared file/app/config selection list, restoring scrollbar visibility only when content overflows without altering other list behavior.

Flow diagram for on-demand scrollbar visibility

flowchart LR
    A["List content"] --> B{"Content exceeds viewport?"}
    B -->|No| C["Scrollbar hidden"]
    B -->|Yes| D["Scrollbar shown"]
Loading

File-Level Changes

Change Details Files
Restore on-demand vertical scrollbars for the disk-selection list.
  • Replace the permanently hidden scrollbar policy with Qt's as-needed policy.
  • Preserve existing model, selection, and interaction behavior.
src/plugins/data-transfer/core/gui/getbackup/createbackupfilewidget.cpp
Restore on-demand vertical scrollbars for reusable selection lists.
  • Update the shared list view to show a scrollbar when items exceed the viewport.
  • Leave scrollbar hidden when the content fits.
src/plugins/data-transfer/core/gui/select/item.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

@pppanghu77
pppanghu77 marked this pull request as draft October 29, 2026 19:34

@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 ✨

@pppanghu77
pppanghu77 force-pushed the agent/agent/967075547759 branch from 6e405ac to a6447db Compare October 29, 2026 20:45
1. Root cause: SelectListView and CreateBackupFileWidget explicitly
   set vertical scrollbar policy to ScrollBarAlwaysOff, hiding the
   scrollbar even when content overflows the viewport
2. Fix: change policy from ScrollBarAlwaysOff to ScrollBarAsNeeded in
   item.cpp:727 and createbackupfilewidget.cpp:256, restoring the Qt
   default behavior where scrollbar appears on demand
3. Impact: FileSelectWidget, AppSelectWidget, ConfigSelectWidget and
   CreateBackupFileWidget all benefit from restored scrollbar; no
   behavior change when content fits within the viewport

Log: Restore scrollbar visibility in data-transfer file list views

Influence:
1. Test file browsing with more items than viewport height
2. Test disk selection list with overflow content
3. Verify scrollbar hidden when content fits viewport

fix: 恢复文件列表视图的滚动条显示

1. 根因:SelectListView 和 CreateBackupFileWidget 显式将垂直滚动条
   策略设为 ScrollBarAlwaysOff,导致内容超出视口时滚动条仍隐藏
2. 方案:将 item.cpp:727 和 createbackupfilewidget.cpp:256 的策略
   从 ScrollBarAlwaysOff 改为 ScrollBarAsNeeded,恢复 Qt 默认行为
3. 影响:FileSelectWidget、AppSelectWidget、ConfigSelectWidget 及
   CreateBackupFileWidget 均受益于滚动条恢复;内容不超出视口时无行为变化

Log: 恢复数据迁移工具文件列表的滚动条显示

Influence:
1. 测试文件数量超出视口时滚动条正常显示
2. 测试磁盘选择列表内容超出视口时滚动条正常显示
3. 验证内容未超出视口时滚动条不显示

PMS: BUG-249127
@pppanghu77
pppanghu77 force-pushed the agent/agent/967075547759 branch from a6447db to 0d01296 Compare October 29, 2026 21:15
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