Skip to content

fix: restore DFloatingWidget border visibility in light theme - #797

Draft
tianming-1996 wants to merge 1 commit into
linuxdeepin:masterfrom
tianming-1996:fix/dfloatingwidget-border-249157
Draft

tianming-1996 wants to merge 1 commit into
linuxdeepin:masterfrom
tianming-1996:fix/dfloatingwidget-border-249157

Conversation

@tianming-1996

@tianming-1996 tianming-1996 commented Oct 29, 2026 •

Copy link
Copy Markdown

修复说明

问题

DFloatingWidget 边框在浅色主题下不可见。

根因

dstyle.cpp 中 drawControl(CE_FloatingWidget) 的绘制路径存在一个无条件 p->setPen(Qt::NoPen) 调用(原第 1348 行),该调用在 if-else 块(第 1343-1346 行)设置 frameShadowBorder() 画笔之后执行,直接覆盖了画笔设置,导致:

  1. 非动画路径:边框完全不绘制(NoPen 覆盖了 frameShadowBorder 画笔)
  2. 动画路径:虽在后续 if 块中补绘边框,但 alpha 值仅 ~10-12%(浅色 12%、深色 10%),近乎不可见

修复

  1. 删除无条件的 p->setPen(Qt::NoPen) 调用,恢复 if-else 块设置的 frameShadowBorder() 画笔
  2. 将动画路径边框 alpha 值从 ~10-12% 提升至 ~30%,确保动画过程中边框可见

影响

  • 仅影响 DFloatingWidget(CE_FloatingWidget)绘制路径
  • 不影响其他控件或绘制路径
  • 不涉及 API 变更或行为逻辑变更

PMS: BUG-249157

Summary by Sourcery

Restore visible DFloatingWidget borders across static and animated rendering paths, particularly in the light theme.

Bug Fixes:

  • Restore DFloatingWidget border visibility by preserving the configured border pen and increasing animated border opacity in both themes.

Chores:

  • Update the copyright year range in dstyle.cpp.

@deepin-ci-robot

Copy link
Copy Markdown
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@deepin-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: tianming-1996

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

Fixes DFloatingWidget border visibility by preserving the configured frame-shadow pen in the normal path and increasing animated border opacity to 30%, with changes limited to the CE_FloatingWidget rendering implementation.

Flow diagram for DFloatingWidget border rendering

flowchart TD
    A[CE_FloatingWidget rendering] --> B{Animation active?}
    B -- No --> C[Use frameShadowBorder pen]
    C --> D[Draw rounded widget with visible border]
    B -- Yes --> E[Draw rounded widget]
    E --> F[Apply 30% opacity animation pen]
    F --> G[Draw visible animated border]
Loading

File-Level Changes

Change Details Files
Restore the base border pen for floating widgets by removing the unconditional pen reset that suppressed the configured border.
  • Preserve the light/dark theme frame-shadow border pen through the rounded-rectangle fill and draw operation.
  • Keep background rendering behavior unchanged.
src/widgets/dstyle.cpp
Increase animated floating-widget border contrast so the border remains visible during transitions.
  • Raise animated border alpha to 30% for both light and dark themes.
  • Retain the existing one-pixel pen and theme-dependent colors.
src/widgets/dstyle.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

1. Root cause: line 1348 unconditionally set Qt::NoPen after the
   if-else block, overriding frameShadowBorder pen for non-animation
   path; animation-path alpha (~12%) too low for light theme
2. Fix: removed the NoPen override; raised animation-path border
   alpha to ~30% for visible borders in both themes
3. Impact: DFloatingWidget border renders correctly in both light
   and dark themes during static and animation states

Log: Fix DFloatingWidget border invisible in light theme

Influence:
1. Test DFloatingWidget border visibility in light and dark themes
2. Verify no regression in DFloatingWidget shadow rendering
3. Verify animation fade does not flicker with border enabled

fix: 修复浅色主题下 DFloatingWidget 边框不可见

1. 根因:第 1348 行无条件 setPen(Qt::NoPen) 覆盖了 if-else 块
   设置的 frameShadowBorder 画笔;动画路径 alpha(约 12%)过低
2. 方案:删除 NoPen 覆盖,恢复 if-else 画笔;动画路径边框 alpha
   提升至约 30%
3. 影响:浅色与深色主题下边框在静态及动画状态均正常显示

Log: 修复浅色主题下浮动控件边框不可见问题

Influence:
1. 测试浅色与深色主题下 DFloatingWidget 边框可见性
2. 验证 DFloatingWidget 阴影绘制无回归
3. 验证动画渐变过程中边框无闪烁

PMS: BUG-249157
@tianming-1996
tianming-1996 force-pushed the fix/dfloatingwidget-border-249157 branch from 1f88f5c to bab50d5 Compare October 29, 2026 21:02

This branch has not been deployed

No deployments
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