Repository navigation
Conversation
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
|
[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. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Reviewer's GuideThe 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
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
deepin pr auto review🤖 AI 代码审查报告📊 总体评价
🔍 详细分析1. 语法逻辑 ✅评价: 语法正确,逻辑清晰 ✅ 通过 潜在问题: 建议: ['无需修改,语法逻辑正确。'] 2. 代码质量 ✅评价: 存在重复代码 ✅ 通过 潜在问题: 建议: ['1. 建议将 ButtonPanel 背景色板定义提取为独立的 QML 组件(如 IconButtonBackground.qml),通过 button 属性参数化引用,消除两文件间的重复代码。', '2. 为关键色板值添加简要注释,说明各状态颜色的设计目的。'] 3. 代码性能 ✅评价: 性能良好,资源使用合理 ✅ 通过 潜在问题: 建议: ['无需修改,性能表现良好。'] 4. 代码安全 🔒评价: 存在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 代码审查工具自动生成 |
修复说明
根因
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