Repository navigation
feat(spinbox): add clear button and refine action buttons - #735
Conversation
|
Sorry @iCancely, your pull request is larger than the review limit of 150,000 diff characters |
8355414 to
1a4bc31
Compare
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 视觉一致性
1a4bc31 to
385e6fe
Compare
deepin pr auto review🤖 AI 代码审查报告📊 总体评价
🔍 详细分析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个安全漏洞 ✅ 通过
安全漏洞详情: 建议: ['无'] 💡 改进建议代码示例// 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 代码审查工具自动生成 |
|
[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. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
e1f7540
into
linuxdeepin:v25-flowstyle
Summary / 概要
Refine the PlusMinusSpinBox action buttons and add a clear button inside the input field.
优化 PlusMinusSpinBox 操作按钮样式,并在输入框内添加清除按钮。
Changes / 变更内容
Replace action icons (
action_add,action_reduce,action_reset) with new DCI resources.替换操作图标(
action_add、action_reduce、action_reset)为新的 DCI 资源。Style plus/minus/reset buttons as
ToolButton, matching the SpinBox height (e.g. 36x36).将加减重置按钮样式改为
ToolButton,高度与输入框一致(例如 36x36)。Set input-to-button spacing to 6px and button-to-button spacing to 0.
设置输入框与按钮间距为 6px,按钮间距为 0。
Add a clear button inside the SpinBox using the
entry_clearicon, consistent with LineEdit's clear button style.在 SpinBox 内添加清除按钮,使用
entry_clear图标,与 LineEdit 清除按钮样式一致。Add a unit test covering button type, icon, size, and spacing.
添加单元测试,覆盖按钮类型、图标、尺寸和间距。
Test / 测试
ut_DPlusMinusSpinBox.buttonsUseToolButtonStyletest passes / 测试通过Summary by Sourcery
Improve PlusMinusSpinBox controls with consistent ToolButton styling and inline input clearing.
New Features:
Enhancements:
Tests: