Skip to content

fix: prevent settings panel and preview area from overlapping on small screens - #50

Merged
deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
re2zero:agent/pms-bug-bot/cc1edef1993e
Oct 13, 2026
Merged

deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
re2zero:agent/pms-bug-bot/cc1edef1993e

Conversation

@re2zero

@re2zero re2zero commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Root Cause Analysis

The scanner manager's settings panel and preview area overlap on small screens because settingsArea (the right-side container in QHBoxLayout) has no minimum width constraint — the layout shrinks it below the 260px needed by its inner settingsGroup, causing overflow into the preview area. The preview area's 480×360 minimum is also too large for small windows, and MainWindow has no minimum size to prevent shrinking past the point where both panels can coexist.

Key evidence: scanwidget.cpp:73 (settingsArea created without setMinimumWidth), scanwidget.cpp:62 (previewArea->setMinimumSize(480, 360)), mainwindow.cpp:44 (only resize, no setMinimumSize).

Fix

Set a 260px minimum width on settingsArea so it can't be compressed below its content's needs. Reduce the preview area minimum from 480×360 to 300×200 so both panels fit in smaller windows. Add an 800×500 minimum window size on MainWindow as a top-level guard against over-shrinking.

Change Safety Assessment

Code Safety

  • Risk Level: Low
  • Target code was written during initial UI setup (April–May 2025) and has never had minimum-size constraints added or removed — this change does not revert any historical fix.
  • No function signatures or layout structure are changed; only minimum-size constraints are added or relaxed.

Business Impact Scope

The changes affect the scanner manager's main window sizing and the scan settings page layout. On small-screen laptops (e.g., 1366×768), the window will no longer shrink to a size where the settings panel and preview area overlap. Normal-screen behavior is unaffected since the new minimums (800×500) are below typical default sizes.

Verification Suggestion

Test on a small-screen laptop: launch the scanner manager, click scan, and verify the settings panel and preview area do not overlap. Resize the window to its minimum and confirm the layout remains usable. Verify no regression on normal screens.


根因分析

扫描管理器在小屏幕上设置面板与预览区域重叠,根因是 settingsArea(QHBoxLayout 右侧容器)未设置最小宽度约束——布局将其压缩到内部 settingsGroup 所需的 260px 以下,内容溢出到预览区域。同时 previewArea 的 480×360 最小尺寸对小窗口而言过大,MainWindow 也未设置窗口最小尺寸兜底。

关键证据:scanwidget.cpp:73(settingsArea 创建时无 setMinimumWidth)、scanwidget.cpp:62(previewArea->setMinimumSize(480, 360))、mainwindow.cpp:44(仅 resize 无 setMinimumSize)。

修复方案

为 settingsArea 设置 260px 最小宽度,防止被压缩到内容所需尺寸以下。将预览区域最小尺寸从 480×360 降至 300×200,使两个区域在小窗口下能共存。为 MainWindow 设置 800×500 最小窗口尺寸,从窗口级别兜底防止过度缩小。

改动安全评估

代码安全评估

  • 风险等级: 低风险
  • 目标代码在初始 UI 搭建阶段(2025年4-5月)编写,历史上从未添加或移除最小尺寸约束——本次修改不会撤销任何历史修复。
  • 不改变任何函数签名或布局结构,仅添加或放宽最小尺寸约束。

业务影响范围

改动影响扫描管理器主窗口尺寸和扫描设置页面布局。在小屏幕笔记本(如 1366×768)上,窗口不再缩小到设置面板与预览区域重叠的尺寸。正常屏幕行为不受影响,因为新的最小尺寸(800×500)低于典型默认尺寸。

验证建议

在小屏幕笔记本上测试:启动扫描管理器,点击扫描,验证设置面板与预览区域不重叠。将窗口缩到最小,确认布局仍然可用。验证正常屏幕下无回归。

Summary by Sourcery

Prevent scanner UI panels from overlapping by enforcing compatible minimum sizes for the main window and its preview and settings areas.

Bug Fixes:

  • Prevent the scanner settings panel and preview area from overlapping when the window is reduced on smaller screens.

Enhancements:

  • Improve small-window usability by balancing preview and settings minimum sizes and enforcing a minimum main window size.

@sourcery-ai

sourcery-ai Bot commented Oct 13, 2026

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

Reviewer's Guide

The PR prevents settings/preview overlap by constraining the settings pane, relaxing the preview pane's minimum dimensions, and preventing the main window from shrinking below a layout-compatible 800×500 size; review primarily the resulting behavior at the minimum window size and on small screens.

File-Level Changes

Change Details Files
Adds coordinated minimum-size constraints to preserve a usable two-pane layout on small windows.
  • Enforces a 260px minimum width for the settings container so its contents are not compressed into the preview area.
  • Reduces the preview area's minimum size to 300×200 to allow both panes to fit in smaller windows.
  • Sets an 800×500 minimum size on the main window as a top-level lower bound.
src/mainwindow.cpp
src/ui/scanwidget.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: re2zero

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 ✨

@re2zero
re2zero force-pushed the agent/pms-bug-bot/cc1edef1993e branch 2 times, most recently from 768360a to 1df3580 Compare October 13, 2026 09:04
…small screens

The window had no width minimum, so on a screen whose half width is below the
779px the two panels needed together it came up narrow enough for them to be laid
out on top of each other (91px of overlap at 1366x768, 134px at 1280x720). The
window minimum is now 800x571, the preview area minimum drops to 300x200, and the
settings area is given the 276px its group box and margins need.

窗口缺少宽度下限,在半屏宽度小于两面板合计所需的 779px 的屏幕上会被创建得过窄,导致设置面板
压在预览区上(1366x768 重叠 91px,1280x720 重叠 134px)。现设置窗口最小尺寸 800x571,预览区
最小尺寸降为 300x200,设置区按组框加边距所需的 276px 设置最小宽度,设置项不再溢出设置区。

Log: 修复小屏幕上扫描设置面板与预览区重叠的问题
PMS: BUG-318759
Influence: 1366x768、1280x720 等小屏幕下设置面板与预览区不再重叠,设置项与按钮完整显示;窗口最小尺寸为 800x571。
@re2zero
re2zero force-pushed the agent/pms-bug-bot/cc1edef1993e branch from 1df3580 to a2033ab Compare October 13, 2026 09:13
@re2zero

re2zero commented Oct 13, 2026

Copy link
Copy Markdown
Contributor Author

/merge

@deepin-bot
deepin-bot Bot merged commit ac2f03d into linuxdeepin:master Oct 13, 2026
14 checks passed
@re2zero
re2zero deleted the agent/pms-bug-bot/cc1edef1993e branch October 13, 2026 12:04
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.

3 participants