Skip to content

fix: correct edit toolbar button hover/press colors - #429

Open
JWWTSL wants to merge 1 commit into
linuxdeepin:masterfrom
JWWTSL:agent/bug/e6692d261410
Open

JWWTSL wants to merge 1 commit into
linuxdeepin:masterfrom
JWWTSL:agent/bug/e6692d261410

Conversation

@JWWTSL

@JWWTSL JWWTSL commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

修复说明

根因

EditToolbar.qml 的 ToolbarButton 和 EditPropertyPanel.qml 的 ModeButton 使用裸 DTK.ToolButton,未覆盖 D.Palette,直接继承 DTK 默认 CrystalColor 配色,浅色主题下 hover 比 press 深(方向反了),深色主题缺少 dark 变体导致叠加黑色(方向错误)。

方案

添加 background P.ButtonPanel 并自定义 D.Palette 覆盖 color1/color2/insideBorderColor/outsideBorderColor,参照 ToolbarIconButton.qml 已验证的修复模式。

影响

hover/press 背景色在浅色和深色主题下均匹配设计稿;选中态不受影响。

修改文件

  • src/qml/EditToolbar.qml — 为 ToolbarButton/ToolSelectButton 添加 P.ButtonPanel 背景及 DTK.Palette 覆盖
  • src/qml/EditPropertyPanel.qml — 为 ModeButton 添加同样的 P.ButtonPanel 背景及 DTK.Palette 覆盖

PMS: BUG-381139

1. Root cause: EditToolbar.qml ToolbarButton and EditPropertyPanel.qml
   ModeButton used bare DTK.ToolButton without D.Palette override,
   inheriting DTK default CrystalColor where hover is darker than press
   (inverted) and dark theme lacks dark variants (wrong direction)
2. Fix: add background P.ButtonPanel with custom D.Palette covering
   color1/color2/insideBorderColor/outsideBorderColor, matching the
   pattern already proven in ToolbarIconButton.qml
3. Impact: hover/press background colors now match design spec for both
   light and dark themes; checked state unaffected (highlighted theme
   not overridden, falls back to DTK default)

Log: 修复图片编辑模式按钮 hover/press 背景色与设计稿不符的问题

Influence:
1. Test edit toolbar buttons hover/press colors in light theme
2. Test edit toolbar buttons hover/press colors in dark theme
3. Test property panel mode buttons hover/press colors in both themes
4. Verify checked/selected state highlight color unchanged
5. Verify normal (non-hover) appearance unchanged

fix: 修复图片编辑模式按钮 hover/press 背景色与设计稿不符

1. 根因:EditToolbar.qml 的 ToolbarButton 和 EditPropertyPanel.qml 的
   ModeButton 使用裸 DTK.ToolButton 未覆盖 D.Palette,直接继承 DTK 默认
   CrystalColor 配色,浅色主题下 hover 比 press 深(方向反了),深色主题
   缺少 dark 变体导致叠加黑色(方向错误)
2. 方案:添加 background P.ButtonPanel 并自定义 D.Palette 覆盖
   color1/color2/insideBorderColor/outsideBorderColor,参照
   ToolbarIconButton.qml 已验证的修复模式
3. 影响:hover/press 背景色在浅色和深色主题下均匹配设计稿;选中态
   不受影响(未覆盖 highlighted 主题,回退 DTK 默认高亮色)

Log: 修复图片编辑模式按钮 hover/press 背景色与设计稿不符的问题

Influence:
1. 测试浅色主题下编辑工具栏按钮 hover/press 背景色
2. 测试深色主题下编辑工具栏按钮 hover/press 背景色
3. 测试属性面板模式按钮 hover/press 背景色(浅色和深色主题)
4. 验证选中态高亮色未受影响
5. 验证 normal(非 hover)外观未变化

PMS: BUG-381139
@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: JWWTSL

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 27, 2026

Copy link
Copy Markdown

Reviewer's Guide

The PR replaces the default backgrounds of the edit-property and edit-toolbar buttons with consistently sized, custom DTK ButtonPanel styling, including Crystal theme support and state-specific colors.

File-Level Changes

Change Details Files
Apply a custom DTK button-panel background and Crystal palette styling to the edit controls.
  • Import DTK style and private button-panel components.
  • Set the color family to CrystalColor and size the background from the shared icon-button style.
  • Define palette-specific border, hover, pressed, light/dark, and gradient colors.
  • Bind the panel to the corresponding edit or toolbar button.
src/qml/EditPropertyPanel.qml
src/qml/EditToolbar.qml

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 ✨

@JWWTSL JWWTSL changed the title {"error":"missing authorization"} fix: correct edit toolbar button hover/press colors Oct 27, 2026
@deepin-ci-robot

Copy link
Copy Markdown

deepin pr auto review

🤖 AI 代码审查报告

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

Pass


📊 总体评价

项目 结果
审查结论 代码审查通过
评分详情 本次提交为 deepin-image-viewer 编辑工具栏图标按钮添加 DTK ButtonPanel 自定义背景样式,包含 CrystalColor 色彩族及多状态(normal/hovered/pressed)边框与填充色板。QML 语法正确,逻辑清晰,无安全漏洞。两文件中存在完全相同的约70行色板定义代码块,存在代码重复问题,建议提取为共享组件以提升可维护性。

🔍 详细分析

1. 语法逻辑 ✅

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

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

建议: ['无需修改,语法逻辑正确。']


2. 代码质量 ✅

评价: 存在重复代码 ✅ 通过

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

建议: ['1. 建议将 ButtonPanel 背景色板定义提取为独立的 QML 组件(如 IconButtonBackground.qml),通过 button 属性参数化引用,消除两文件间的重复代码。', '2. 为关键色板值添加简要注释,说明各状态颜色的设计目的。']


3. 代码性能 ✅

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

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

建议: ['无需修改,性能表现良好。']


4. 代码安全 🔒

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

🔐 发现 0 个安全漏洞

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

建议: ['无需修改,安全合规。']


💡 改进建议代码示例

// 建议提取共享组件 IconButtonBackground.qml // // import QtQuick // import org.deepin.dtk 1.0 as DTK // import org.deepin.dtk.style 1.0 as DS // import org.deepin.dtk.private 1.0 as P // // P.ButtonPanel { //     id: root //     property var button  // 由调用方传入 // //     implicitWidth: DS.Style.iconButton.backgroundSize //     implicitHeight: DS.Style.iconButton.backgroundSize // //     insideBorderColor: DTK.Palette { //         normal { common: Qt.rgba(1, 1, 1, 0.1); crystal: Qt.rgba(1, 1, 1, 0.1) } //         normalDark { common: Qt.rgba(1, 1, 1, 0.1); crystal: Qt.rgba(1, 1, 1, 0.1) } //         hovered { common: Qt.rgba(1, 1, 1, 0.2); crystal: Qt.rgba(1, 1, 1, 0.15) } //         pressed { common: Qt.rgba(1, 1, 1, 0.03); crystal: Qt.rgba(0, 0, 0, 0.03) } //     } //     // ... outsideBorderColor, color1, color2 同理 ... //     color2: color1 // } // // 在 EditPropertyPanel.qml 中使用: // background: IconButtonBackground { button: modeButton } // // 在 EditToolbar.qml 中使用: // background: IconButtonBackground { button: toolbarButton }

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

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