Skip to content

fix: make HighlightPanel derive from Control - #722

Open
Ivy233 wants to merge 1 commit into
linuxdeepin:masterfrom
Ivy233:fix/dde-shell-warning-batch3
Open

Ivy233 wants to merge 1 commit into
linuxdeepin:masterfrom
Ivy233:fix/dde-shell-warning-batch3

Conversation

@Ivy233

@Ivy233 Ivy233 commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

HighlightPanel is used as ListView.highlight in Menu / ArrowListView without a QQuickControl ancestor. Its backgroundColor is a typed color (D.Color.Highlight), and DQuickControlColorSelector left it invalid when no Control was found, printing ColorSelector: The ... is an invalid color and rendering an opaque black highlight.

Derive HighlightPanel from Control and use the background Rectangle as its contentItem, so ColorSelector finds a Control on the panel itself and resolves the typed color from its palette. This fixes all HighlightPanel uses without caller-side wrappers or an application-wide color fallback.

Trade-off: the panel now resolves palette/state from itself and no longer inherits hovered / pressed / disabled from an enclosing Control. In-tree uses activate HighlightPanel for checked/highlighted state, so their normal appearance is preserved. The Qt5 HighlightPanel is unchanged.

Verification:

  • Standalone D.HighlightPanel: no warning, backgroundColor = #308cc6.
  • ListView.highlight geometry before/after: highlight 0,0 180x30; background/contentItem 0,0 180x30.
  • ut_ColorSelector.* 4/4 passed.
  • QML component loading loadQml/ut_dtkDeclarativeQmls.* 90/90 passed.

修复:将 HighlightPanel 的根改为 Control

HighlightPanel 在 Menu / ArrowListView 中作为 ListView.highlight 使用,父链上没有 QQuickControl。其 backgroundColor 是类型化颜色(D.Color.Highlight),找不到 Control 时 DQuickControlColorSelector 会返回无效颜色,打印 ColorSelector: The ... is an invalid color,并把高亮渲染成不透明黑色。

将 HighlightPanel 的根改为 Control,并把背景 Rectangle 作为其 contentItem,使 ColorSelector 能在面板自身找到 Control,并从自己的 palette 解析类型化颜色。这样无需调用方套壳,也无需增加应用级颜色兜底。

注意:面板现在以自身作为 Control,不再继承外层 Control 的 hovered / pressed / disabled 状态;库内使用点主要依赖 checked/highlighted 状态,正常外观保持不变。Qt5 的 HighlightPanel 未改动。

验证:

  • 独立 D.HighlightPanel:无 warning,backgroundColor = #308cc6。
  • ListView.highlight 修改前后几何:highlight 0,0 180x30;background/contentItem 0,0 180x30。
  • ut_ColorSelector.* 4/4 通过。
  • QML 组件加载 loadQml/ut_dtkDeclarativeQmls.* 90/90 通过。

PMS: TASK-394335

Summary by Sourcery

Make Qt6 HighlightPanel derive from Control to reliably resolve its palette highlight color when used as a ListView highlight.

Bug Fixes:

  • Fix invalid typed highlight colors and opaque black rendering when HighlightPanel is used without an enclosing Control.

Enhancements:

  • Make the Qt6 HighlightPanel a Control and use its background as the content item so it resolves colors from its own palette and state.

@sourcery-ai

sourcery-ai Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

UI

Make Qt6 HighlightPanel a Control and use its background Rectangle as contentItem, allowing typed highlight colors to resolve from the panel’s own palette.

  • qt6/src/qml/HighlightPanel.qml L6-10 (+3 small edits)

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

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

@deepin-bot

deepin-bot Bot commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

TAG Bot

New tag: 6.7.51
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #723

@Ivy233
Ivy233 force-pushed the fix/dde-shell-warning-batch3 branch from 7d93864 to 1b23d50 Compare October 21, 2026 05:41
Comment thread qt6/src/qml/ArrowListView.qml Resolved
@Ivy233
Ivy233 force-pushed the fix/dde-shell-warning-batch3 branch from 1b23d50 to 0064daf Compare October 21, 2026 09:09
@Ivy233
Ivy233 requested a review from 18202781743 October 21, 2026 09:34
@deepin-bot

deepin-bot Bot commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

TAG Bot

New tag: 6.7.52
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #738

@Ivy233
Ivy233 force-pushed the fix/dde-shell-warning-batch3 branch from 0064daf to 4c74707 Compare November 5, 2026 12:48
@Ivy233 Ivy233 changed the title fix: fall back to standard palette for typed colors without control fix: make HighlightPanel derive from Control Nov 5, 2026
@Ivy233
Ivy233 force-pushed the fix/dde-shell-warning-batch3 branch from 4c74707 to 3d521a4 Compare November 5, 2026 12:50
@deepin-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: 18202781743, Ivy233

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

@deepin-bot

deepin-bot Bot commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

TAG Bot

New tag: 6.7.53
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #748

HighlightPanel is used as ListView.highlight in Menu/ArrowListView without
a Control ancestor. Its backgroundColor is a typed color
(D.Color.Highlight), and DQuickControlColorSelector left it invalid when
no Control was found, printing "ColorSelector: The ... is an invalid
color" and rendering an opaque black highlight.

Derive HighlightPanel from Control and use the background Rectangle as
its contentItem, so ColorSelector finds a Control on the panel itself and
resolves the typed color from its palette. This fixes all HighlightPanel
uses without a caller-side wrapper or an application-wide color fallback.

Because the panel is now its own control, it resolves palette/state from
itself; enclosing Control hover/pressed/disabled state is not inherited.
In-tree uses activate HighlightPanel for checked/highlighted state, so
this keeps their normal appearance.

为 HighlightPanel 增加 Control 基类

HighlightPanel 在 Menu/ArrowListView 中作为 ListView.highlight 使用,
父链上没有 Control。其 backgroundColor 是类型化颜色
(D.Color.Highlight),找不到 Control 时 DQuickControlColorSelector
会返回无效颜色,打印 "ColorSelector: The ... is an invalid color",
并把高亮渲染成不透明黑色。

将 HighlightPanel 的根改为 Control,并把背景 Rectangle 作为其
contentItem,使 ColorSelector 能在面板自身找到 Control,并从自己的
palette 解析类型化颜色。这样无需调用方套壳,也无需增加应用级颜色兜底。

注意:面板现在以自身作为 Control,不再继承外层 Control 的
hovered/pressed/disabled 状态;库内使用点主要依赖 checked/highlighted
状态,因此正常外观保持不变。

PMS: TASK-394335
@18202781743
18202781743 force-pushed the fix/dde-shell-warning-batch3 branch from 3d521a4 to ecd53ff Compare November 12, 2026 02:58
@deepin-ci-robot

Copy link
Copy Markdown
Contributor

deepin pr auto review

🤖 AI 代码审查报告

总体评分: 100 分 (通过阈值: 70分)

Pass


📊 总体评价

项目 结果
审查结论 代码审查通过
评分详情 本次提交将 HighlightPanel 从 Item 改为继承 T.Control,使用 contentItem 替代手动 anchors.fill 的 Rectangle,修复了控件继承结构问题。变更干净简洁,四维度均无问题,启发式扫描与 OCR 审查均未发现缺陷。

🔍 详细分析

1. 语法逻辑 ✅

评价: 语法正确,逻辑清晰 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: []


2. 代码质量 ✅

评价: 代码结构清晰,注释完整 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: []


3. 代码性能 ✅

评价: 性能良好,资源使用合理 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: []


4. 代码安全 🔒

评价: 存在0个安全漏洞 ✅ 通过

🔐 发现 0 个安全漏洞

安全漏洞详情:
✅ 未发现安全漏洞

建议: []


💡 改进建议代码示例


本报告由 AI 代码审查工具自动生成

@deepin-bot

deepin-bot Bot commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

TAG Bot

New tag: 6.7.54
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #756

@deepin-bot

deepin-bot Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

TAG Bot

New tag: 6.7.55
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #761

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.

3 participants