Skip to content

feat(spinbox): add clear button and refine action buttons - #735

Merged
18202781743 merged 1 commit into
linuxdeepin:v25-flowstylefrom
iCancely:fix/plusminus-spinbox-style
Oct 28, 2026
Merged

18202781743 merged 1 commit into
linuxdeepin:v25-flowstylefrom
iCancely:fix/plusminus-spinbox-style

Conversation

@iCancely

@iCancely iCancely commented Oct 27, 2026 •

Copy link
Copy Markdown

Summary / 概要

Refine the PlusMinusSpinBox action buttons and add a clear button inside the input field.

优化 PlusMinusSpinBox 操作按钮样式,并在输入框内添加清除按钮。

Changes / 变更内容

  1. Replace action icons (action_add, action_reduce, action_reset) with new DCI resources.
    替换操作图标(action_add、action_reduce、action_reset)为新的 DCI 资源。

  2. Style plus/minus/reset buttons as ToolButton, matching the SpinBox height (e.g. 36x36).
    将加减重置按钮样式改为 ToolButton,高度与输入框一致(例如 36x36)。

  3. Set input-to-button spacing to 6px and button-to-button spacing to 0.
    设置输入框与按钮间距为 6px,按钮间距为 0。

  4. Add a clear button inside the SpinBox using the entry_clear icon, consistent with LineEdit's clear button style.
    在 SpinBox 内添加清除按钮,使用 entry_clear 图标,与 LineEdit 清除按钮样式一致。

  5. Add a unit test covering button type, icon, size, and spacing.
    添加单元测试,覆盖按钮类型、图标、尺寸和间距。

Test / 测试

  • Qt6 build passes / Qt6 编译通过
  • ut_DPlusMinusSpinBox.buttonsUseToolButtonStyle test passes / 测试通过
  • Qt5 build passes / Qt5 编译通过

Summary by Sourcery

Improve PlusMinusSpinBox controls with consistent ToolButton styling and inline input clearing.

New Features:

  • Add an inline clear button to PlusMinusSpinBox inputs.

Enhancements:

  • Refine PlusMinusSpinBox action controls with ToolButton styling, consistent sizing, updated spacing, and refreshed action icons.

Tests:

  • Add Qt6 coverage validating PlusMinusSpinBox button types, icons, dimensions, and spacing.

@sourcery-ai

sourcery-ai Bot commented Oct 27, 2026

Copy link
Copy Markdown

Sorry @iCancely, your pull request is larger than the review limit of 150,000 diff characters

@iCancely
iCancely force-pushed the fix/plusminus-spinbox-style branch from 8355414 to 1a4bc31 Compare October 27, 2026 07:04
@iCancely

Copy link
Copy Markdown
Author

@18202781743

Comment thread src/qml/FlowStyle.qml Outdated
1. Replace action icons with new DCI resources
2. Style plus/minus/reset buttons as ToolButton with matching height
3. Set input-button spacing to 6px and button spacing to 0
4. Add clear button inside SpinBox using entry_clear icon
5. Add unit test for button geometry and styling

Log: refine PlusMinusSpinBox button styling and add clear button
Influence: improve PlusMinusSpinBox visual consistency

feat(spinbox): 添加清除按钮并优化操作按钮

1. 替换操作图标为新的 DCI 资源
2. 将加减重置按钮样式改为 ToolButton 并匹配高度
3. 设置输入框与按钮间距为 6px,按钮间距为 0
4. 在 SpinBox 内添加清除按钮,使用 entry_clear 图标
5. 添加按钮几何与样式的单元测试

Log: 优化 PlusMinusSpinBox 按钮样式并添加清除按钮
Influence: 提升 PlusMinusSpinBox 视觉一致性
@iCancely
iCancely force-pushed the fix/plusminus-spinbox-style branch from 1a4bc31 to 385e6fe Compare October 28, 2026 05:18
@deepin-ci-robot

Copy link
Copy Markdown
Contributor

deepin pr auto review

🤖 AI 代码审查报告

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

Pass


📊 总体评价

项目 结果
审查结论 代码审查通过
评分详情 本次提交为 PlusMinusSpinBox 添加清除按钮并将操作按钮从 IconButton 改为 ToolButton,代码结构清晰,测试覆盖全面。存在少量代码质量改进点(evaluateOnItem 缺少错误检查、缺少 spinBox 高度断言、图标尺寸使用魔法数字、#endif 后缺少空行),但无安全漏洞,整体代码质量良好。

🔍 详细分析

1. 语法逻辑 ✅

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

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

建议: ['无']


2. 代码质量 ✅

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

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

建议: ['在 evaluateOnItem 中添加 hasError() 检查,求值失败时调用 ADD_FAILURE() 报告错误信息和表达式内容', '在尺寸比较前添加 ASSERT_GT(spinBox->height(), 0) 确保布局正常', '在 #endif(第404行)后添加空行以保持风格一致']


3. 代码性能 ✅

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

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

建议: ['将 icon.width: 16 和 icon.height: 16 替换为 DS.Style.plusMinusSpinBox.buttonIconSize,与样式属性保持一致']


4. 代码安全 🔒

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

🔐 发现 0 个安全漏洞

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

建议: ['无']


💡 改进建议代码示例

// tests/ut_dtkdeclatative_qmls.cpp - evaluateOnItem 添加错误检查
QVariant evaluateOnItem(QQuickItem *scope, const QString &expression)
{
    QQmlExpression qmlExpression(qmlContext(scope), scope, expression);
    QVariant result = qmlExpression.evaluate();
    if (qmlExpression.hasError()) {
        ADD_FAILURE() << "QML expression evaluation failed: "
                      << qmlExpression.error().toString().toStdString()
                      << " Expression: " << expression.toStdString();
    }
    return result;
}

// tests/ut_dtkdeclatative_qmls.cpp - 添加 spinBox 高度断言
ASSERT_TRUE(spinBox);
ASSERT_GT(spinBox->height(), 0);

// qt6/src/qml/PlusMinusSpinBox.qml - 使用样式属性替代魔法数字
// 将三个 ToolButton 中的:
icon.width: 16
icon.height: 16
// 替换为:
icon.width: DS.Style.plusMinusSpinBox.buttonIconSize
icon.height: DS.Style.plusMinusSpinBox.buttonIconSize

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

@deepin-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

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

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

@18202781743
18202781743 merged commit e1f7540 into linuxdeepin:v25-flowstyle Oct 28, 2026
19 of 20 checks passed
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