Skip to content

fix: resolve dcc-edit icon blur at 1.25x scale#3334

Open
fly602 wants to merge 1 commit into
linuxdeepin:masterfrom
fly602:fix-icon
Open

fix: resolve dcc-edit icon blur at 1.25x scale#3334
fly602 wants to merge 1 commit into
linuxdeepin:masterfrom
fly602:fix-icon

Conversation

@fly602

@fly602 fly602 commented Jul 2, 2026

Copy link
Copy Markdown
Contributor
  1. Wrap action buttons in RowLayout containers in EditActionLabel.qml
  2. Wrap edit and delete action buttons in RowLayout in AuthenticationMain.qml
  3. Replace direct width/height with Layout.preferredWidth/ preferredHeight
  4. Add proper Layout margins and spacing properties
  5. Import QtQuick.Layouts module in EditActionLabel.qml
  6. Use RowLayout to ensure proper pixel alignment at fractional scale factors

The action buttons were previously positioned using anchors directly, which could result in sub-pixel positioning at fractional scale factors like 1.25x. This caused the dcc-edit and dcc_delete icons to appear blurry. By using RowLayout, the layout system handles pixel alignment more accurately, preventing the blurriness issue.

Log: 修复dcc-edit图标在1.25倍缩放下显示模糊的问题

Influence:

  1. Test icon rendering at 1.25x display scale - verify no blurriness
  2. Test icon rendering at 1x, 1.5x, and 2x scales for consistency
  3. Verify edit button functionality in account settings (EditActionLabel)
  4. Verify edit and delete buttons in authentication settings
  5. Test button hover and pressed visual states
  6. Verify button alignment and positioning within the layout
  7. Check that button visibility on hover still works correctly

fix: 解决dcc-edit图标在1.25倍缩放下的模糊问题

  1. 在EditActionLabel.qml中将操作按钮包装在RowLayout容器中
  2. 在AuthenticationMain.qml中将编辑和删除按钮包装在RowLayout中
  3. 将直接的width/height替换为Layout.preferredWidth/preferredHeight
  4. 添加适当的Layout边距和间距属性
  5. 在EditActionLabel.qml中导入QtQuick.Layouts模块
  6. 使用RowLayout确保在小数缩放因子下正确的像素对齐

操作按钮之前直接使用anchors进行定位,在小数缩放因子(如1.25倍)下可
能导致亚像素定位。这导致dcc-edit和dcc_delete图标显示模糊。通过使用
RowLayout,布局系统能更准确地处理像素对齐,从而避免模糊问题。

Log: 修复dcc-edit图标在1.25倍缩放下显示模糊的问题

Influence:

  1. 在1.25倍显示缩放下测试图标渲染 - 验证无模糊
  2. 在1倍、1.5倍和2倍缩放下测试图标渲染一致性
  3. 验证账户设置中编辑按钮功能(EditActionLabel)
  4. 验证认证设置中编辑和删除按钮功能
  5. 测试按钮悬停和按下视觉状态
  6. 验证按钮在布局中的对齐和定位
  7. 检查悬停时按钮可见性是否正常工作

PMS: BUG-364883

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

Sorry @fly602, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

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

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

1. Wrap action buttons in RowLayout containers in EditActionLabel.qml
2. Wrap edit and delete action buttons in RowLayout in
AuthenticationMain.qml
3. Replace direct width/height with Layout.preferredWidth/
preferredHeight
4. Add proper Layout margins and spacing properties
5. Import QtQuick.Layouts module in EditActionLabel.qml
6. Use RowLayout to ensure proper pixel alignment at fractional scale
factors

The action buttons were previously positioned using anchors directly,
which could result in sub-pixel positioning at fractional scale factors
like 1.25x. This caused the dcc-edit and dcc_delete icons to appear
blurry. By using RowLayout, the layout system handles pixel alignment
more accurately, preventing the blurriness issue.

Log: 修复dcc-edit图标在1.25倍缩放下显示模糊的问题

Influence:
1. Test icon rendering at 1.25x display scale - verify no blurriness
2. Test icon rendering at 1x, 1.5x, and 2x scales for consistency
3. Verify edit button functionality in account settings
(EditActionLabel)
4. Verify edit and delete buttons in authentication settings
5. Test button hover and pressed visual states
6. Verify button alignment and positioning within the layout
7. Check that button visibility on hover still works correctly

fix: 解决dcc-edit图标在1.25倍缩放下的模糊问题

1. 在EditActionLabel.qml中将操作按钮包装在RowLayout容器中
2. 在AuthenticationMain.qml中将编辑和删除按钮包装在RowLayout中
3. 将直接的width/height替换为Layout.preferredWidth/preferredHeight
4. 添加适当的Layout边距和间距属性
5. 在EditActionLabel.qml中导入QtQuick.Layouts模块
6. 使用RowLayout确保在小数缩放因子下正确的像素对齐

操作按钮之前直接使用anchors进行定位,在小数缩放因子(如1.25倍)下可
能导致亚像素定位。这导致dcc-edit和dcc_delete图标显示模糊。通过使用
RowLayout,布局系统能更准确地处理像素对齐,从而避免模糊问题。

Log: 修复dcc-edit图标在1.25倍缩放下显示模糊的问题

Influence:
1. 在1.25倍显示缩放下测试图标渲染 - 验证无模糊
2. 在1倍、1.5倍和2倍缩放下测试图标渲染一致性
3. 验证账户设置中编辑按钮功能(EditActionLabel)
4. 验证认证设置中编辑和删除按钮功能
5. 测试按钮悬停和按下视觉状态
6. 验证按钮在布局中的对齐和定位
7. 检查悬停时按钮可见性是否正常工作

PMS: BUG-364883
@deepin-ci-robot

Copy link
Copy Markdown

deepin pr auto review

★ 总体评分:85分

■ 【总体评价】

代码实现了操作按钮布局模式的统一重构,但存在轻度代码重复问题
逻辑正确但因重复的背景样式代码扣15分

■ 【详细分析】

  • 1.语法逻辑(完全正确)✓

EditActionLabel.qmlAuthenticationMain.qml 中正确引入了 RowLayout 容器,原 D.ActionButton 的尺寸属性从 width/height 准确转换为 Layout.preferredWidth/Height,锚点从子项正确上移至父容器,AuthenticationMain.qml 中通过固定宽度60和零间距保证了紧凑排列,逻辑连贯无误。
建议:保持当前的布局重构方式,无需额外修改。

  • 2.代码质量(一般)✕

EditActionLabel.qmleditButton 以及 AuthenticationMain.qmleditButtondeleteButton 中,background: Rectangle 及其内部的 pressedColorhoveredColor 等自定义样式代码存在高度重复。
潜在问题:违反 DRY 原则,后续维护时若需修改操作按钮的背景悬浮或按压样式,需在多处同步修改,容易遗漏导致 UI 表现不一致。
建议:将重复的 background: Rectangle 代码块提取为一个独立的 QML 组件(如 ActionBackground.qml),在各处直接引用该组件。

  • 3.代码性能(无性能问题)✓

引入 RowLayout 仅产生极小的布局计算开销,对渲染性能无实质影响,未引入不必要的绑定、频繁重绘或复杂的嵌套层级。
建议:无需优化。

  • 4.代码安全(存在0个安全漏洞)✓

漏洞对比统计:新增漏洞 0 个,减少漏洞 0 个,持平 0 个
本次变更为纯 UI 布局重构,不涉及用户输入处理、网络请求、文件系统操作或系统命令调用,无任何安全风险面。
建议:继续保持安全编码意识。

■ 【改进建议代码示例】

// 新建 ActionBackground.qml 提取重复的背景样式
import QtQuick
import org.deepin.dtk 1.0 as D
import org.deepin.dtk.style 1.0 as DS

Rectangle {
    anchors.fill: parent
    property D.Palette pressedColor: D.Palette {
        normal: Qt.rgba(0, 0, 0, 0.2)
        normalDark: Qt.rgba(1, 1, 1, 0.25)
    }
    property D.Palette hoveredColor: D.Palette {
        normal: Qt.rgba(0, 0, 0, 0.1)
        normalDark: Qt.rgba(1, 1, 1, 0.1)
    }
    radius: DS.Style.control.radius
    color: parent.pressed ? D.ColorSelector.pressedColor : (parent.hovered ? D.ColorSelector.hoveredColor : "transparent")
    border {
        color: parent.palette.highlight
        width: parent.visualFocus ? DS.Style.control.focusBorderWidth : 0
    }
}

// 在 EditActionLabel.qml 中使用示例
RowLayout {
    id: actionButtons
    anchors {
        right: edit.right
        verticalCenter: edit.verticalCenter
    }

    D.ActionButton {
        id: editButton
        focusPolicy: Qt.StrongFocus
        Layout.preferredWidth: 30
        Layout.preferredHeight: 30
        icon.name: "dcc-edit"
        icon.width: DS.Style.edit.actionIconSize
        icon.height: DS.Style.edit.actionIconSize
        hoverEnabled: true
        background: ActionBackground {}
        onClicked: {
            edit.readOnly = false
            edit.selectAll()
            edit.forceActiveFocus()
        }
    }
}

@deepin-bot

deepin-bot Bot commented Jul 9, 2026

Copy link
Copy Markdown

TAG Bot

New tag: 6.1.99
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #3348

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