fix(dciicon): restore smooth filtering for mixed-DPI scaling - #677
fix(dciicon): restore smooth filtering for mixed-DPI scaling#677gugullll wants to merge 1 commit into
Conversation
Remove the scale-based setSmooth(false) overrides in DQuickDciIconImage so icons fall back to the default smooth=true filtering, eliminating jaggies when the scene is downsampled to lower-DPI outputs. Forward IconLabel's smooth to its internal image and bind smooth: control.smooth in controls. 移除DQuickDciIconImage中基于scale的smooth强制覆盖,恢复默认平滑过滤, 修复混合DPI下场景降采样导致的图标锯齿。IconLabel的smooth转发到内部 图像,并在各控件中绑定smooth: control.smooth。 Log: 修复混合DPI下图标锯齿,恢复DciIcon平滑渲染 Influence: 所有使用DciIcon/IconLabel的控件(Button/ToolButton/CheckDelegate/ItemDelegate/MenuItem/AboutDialog等)在混合DPI下图标平滑渲染;外部可通过smooth属性控制图标过滤。
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: gugullll 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 guide (collapsed on small PRs)Reviewer's GuideRestores smooth texture filtering for DCI icons by removing scale-dependent overrides, then propagates IconLabel and control smooth properties through the internal image and affected QML controls to prevent mixed-DPI downsampling artifacts while preserving caller control. Sequence diagram for IconLabel smooth filtering propagationsequenceDiagram
participant Control as QMLControl
participant Label as IconLabel
participant Image as DQuickDciIconImage
participant Texture as QQuickImage
Control->>Label: smoothChanged
Label->>Image: setSmooth()
Image->>Texture: setSmooth()
Texture-->>Image: smooth filtering updated
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="src/private/dquickdciiconimage.cpp" line_range="269" />
<code_context>
connect(this, &DQuickDciIconImage::smoothChanged, d->imageItem, &QQuickImage::setSmooth);
connect(d->imageItem, &QQuickItem::widthChanged, this, [d]() { d->scheduleLayout(); });
connect(d->imageItem, &QQuickItem::heightChanged, this, [d]() { d->scheduleLayout(); });
- connect(this, &QQuickItem::scaleChanged, this, [this]() {setSmooth(!qFuzzyCompare(scale(), 1.0)); });
}
</code_context>
<issue_to_address>
**issue (bug_risk):** DQuickDciIconImage no longer enables smooth filtering when it is created or completed. Its inherited QQuickItem smooth property defaults to false, and IconLabel now copies that false default into the internal image; the new control bindings likewise propagate each control's false default, so icons remain unsmoothed instead of falling back to smooth=true.
**Triggers:** When the caller does not explicitly set smooth: true.
**Suggested fix:** Initialize DQuickDciIconImage/ DQuickIconLabel smooth to true, or preserve an explicit true default before forwarding the property.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| connect(this, &DQuickDciIconImage::smoothChanged, d->imageItem, &QQuickImage::setSmooth); | ||
| connect(d->imageItem, &QQuickItem::widthChanged, this, [d]() { d->scheduleLayout(); }); | ||
| connect(d->imageItem, &QQuickItem::heightChanged, this, [d]() { d->scheduleLayout(); }); | ||
| connect(this, &QQuickItem::scaleChanged, this, [this]() {setSmooth(!qFuzzyCompare(scale(), 1.0)); }); |
There was a problem hiding this comment.
issue (bug_risk): DQuickDciIconImage no longer enables smooth filtering when it is created or completed. Its inherited QQuickItem smooth property defaults to false, and IconLabel now copies that false default into the internal image; the new control bindings likewise propagate each control's false default, so icons remain unsmoothed instead of falling back to smooth=true.
Triggers: When the caller does not explicitly set smooth: true.
Suggested fix: Initialize DQuickDciIconImage/ DQuickIconLabel smooth to true, or preserve an explicit true default before forwarding the property.
deepin pr auto review🤖 AI 代码审查报告📊 总体评价
🔍 详细分析1. 语法逻辑 ✅评价: 优秀 ✅ 通过 潜在问题: 建议: 无需修改,语法正确,逻辑清晰,边界处理完善 2. 代码质量 ✅评价: 优秀 ✅ 通过 潜在问题: 建议: 建议在dquickdciiconimage.cpp中移除scaleChanged连接处添加简要注释说明移除原因,便于后续维护者理解历史变更 3. 代码性能 ✅评价: 优秀 ✅ 通过 潜在问题: 建议: 无需修改,性能良好,资源使用合理 4. 代码安全 🔒评价: 优秀 ✅ 通过
安全漏洞详情: 建议: 无需安全加固,安全合规 💡 改进建议代码示例// dquickdciiconimage.cpp - 变更说明(无需修改,当前实现已正确)
// 移除的代码(旧逻辑,已正确删除):
// 构造函数中: connect(this, &QQuickItem::scaleChanged, this, [this]() { setSmooth(!qFuzzyCompare(scale(), 1.0)); });
// componentComplete()中: setSmooth(!qFuzzyCompare(scale(), 1.0));
// dquickiconlabel.cpp - 新增代码(已正确实现):
void DQuickIconLabelPrivate::createIconImage()
{
// ... 现有代码 ...
image->imageItem()->setFallbackSource(icon.source());
// 新增:同步smooth属性到内部图标图像
image->setSmooth(q->smooth());
QObject::connect(q, &QQuickItem::smoothChanged, image, &QQuickItem::setSmooth);
// ... 后续代码 ...
}
// QML文件变更示例 (Button.qml) - 新增 smooth 绑定:
D.IconLabel {
spacing: control.spacing
mirrored: control.mirrored
smooth: control.smooth // 新增:绑定控件的smooth属性
display: control.display
// ...
}本报告由 AI 代码审查工具自动生成 |
Remove the scale-based setSmooth(false) overrides in DQuickDciIconImage so icons fall back to the default smooth=true filtering, eliminating jaggies when the scene is downsampled to lower-DPI outputs. Forward IconLabel's smooth to its internal image and bind smooth: control.smooth in controls.
移除DQuickDciIconImage中基于scale的smooth强制覆盖,恢复默认平滑过滤,
修复混合DPI下场景降采样导致的图标锯齿。IconLabel的smooth转发到内部
图像,并在各控件中绑定smooth: control.smooth。
Log: 修复混合DPI下图标锯齿,恢复DciIcon平滑渲染
Influence: 所有使用DciIcon/IconLabel的控件(Button/ToolButton/CheckDelegate/ItemDelegate/MenuItem/AboutDialog等)在混合DPI下图标平滑渲染;外部可通过smooth属性控制图标过滤。
Summary by Sourcery
Restore smooth filtering for DCI icons and propagate smoothing controls throughout the QML control set.
Bug Fixes:
Enhancements: