fix: clear DCi icon state when setting other icon types#689
Merged
18202781743 merged 1 commit intolinuxdeepin:masterfrom Oct 16, 2025
Merged
fix: clear DCi icon state when setting other icon types#68918202781743 merged 1 commit intolinuxdeepin:masterfrom
18202781743 merged 1 commit intolinuxdeepin:masterfrom
Conversation
Contributor
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: robertkill 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 |
deepin-ci-robot
added a commit
to linuxdeepin/dtk6widget
that referenced
this pull request
Oct 16, 2025
Synchronize source files from linuxdeepin/dtkwidget. Source-pull-request: linuxdeepin/dtkwidget#689
18202781743
reviewed
Oct 16, 2025
src/widgets/diconbutton.cpp
Outdated
| { | ||
| D_D(DIconButton); | ||
|
|
||
| QAbstractButton::setIcon(QIcon()); |
Contributor
There was a problem hiding this comment.
这种重置放在真实赋值后面会不会更好,
重置可能会触发Icon重绘,这时可能先是一个空的,之后再绘制正确的icon,
可能导致闪烁,
Fixed an issue where DCi icon state was not properly cleared when setting other icon types (QIcon, QStyle::StandardPixmap, DStyle::StandardPixmap). This could cause incorrect icon rendering when switching between different icon types. The changes ensure that when setting a non-DCi icon, the DCi icon state is properly reset to avoid conflicts between different icon systems. When setting a DCi icon, the QAbstractButton icon is cleared to prevent interference. Log: Fixed icon display issues when switching between different icon types Influence: 1. Test switching between QIcon, standard pixmap icons, and DCi icons 2. Verify icons display correctly after type changes 3. Test button appearance in different states (normal, hover, pressed) 4. Check icon rendering consistency across different button types fix: 设置其他图标类型时正确清除 DCi 图标状态 修复了在设置其他图标类型(QIcon、QStyle::StandardPixmap、 DStyle::StandardPixmap)时未正确清除 DCi 图标状态的问题。这可能导致在不 同图标类型之间切换时出现错误的图标渲染。 这些更改确保在设置非 DCi 图标时,DCi 图标状态被正确重置,以避免不同图 标系统之间的冲突。当设置 DCi 图标时,QAbstractButton 图标被清除以防止 干扰。 Log: 修复在不同图标类型之间切换时的图标显示问题 Influence: 1. 测试在 QIcon、标准像素图标和 DCi 图标之间的切换 2. 验证类型更改后图标正确显示 3. 测试按钮在不同状态(正常、悬停、按下)下的外观 4. 检查不同按钮类型之间的图标渲染一致性 PMS: BUG-337027
deepin-ci-robot
added a commit
to linuxdeepin/dtk6widget
that referenced
this pull request
Oct 16, 2025
Synchronize source files from linuxdeepin/dtkwidget. Source-pull-request: linuxdeepin/dtkwidget#689
Contributor
deepin pr auto review这段代码是关于两个类(DButtonBoxButton 和 DIconButton)的图标设置相关功能的修改。我来分析一下代码的改进点: 语法逻辑
代码质量
代码性能
代码安全
改进建议
if (d->dciIcon != icon) {
d->dciIcon = icon;
d->iconType = -1;
QAbstractButton::setIcon(QIcon());
this->update();
this->updateGeometry();
}
void DIconButton::updateIcon(const QIcon &icon, int type)
{
D_D(DIconButton);
d->dciIcon = DDciIcon();
d->iconType = type;
QAbstractButton::setIcon(icon);
this->update();
this->updateGeometry();
}
void DIconButton::setIcon(const QIcon &icon)
{
if (icon.isNull()) {
qWarning() << "Attempt to set null icon";
return;
}
D_D(DIconButton);
d->dciIcon = DDciIcon();
d->iconType = -1;
QAbstractButton::setIcon(icon);
}
总的来说,这段代码的实现是合理的,但还有一些可以优化的地方,特别是在性能和代码复用方面。 |
18202781743
approved these changes
Oct 16, 2025
18202781743
pushed a commit
to linuxdeepin/dtk6widget
that referenced
this pull request
Oct 16, 2025
Synchronize source files from linuxdeepin/dtkwidget. Source-pull-request: linuxdeepin/dtkwidget#689
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixed an issue where DCi icon state was not properly cleared when setting other icon types (QIcon, QStyle::StandardPixmap, DStyle::StandardPixmap). This could cause incorrect icon rendering when switching between different icon types.
The changes ensure that when setting a non-DCi icon, the DCi icon state is properly reset to avoid conflicts between different icon systems. When setting a DCi icon, the QAbstractButton icon is cleared to prevent interference.
Log: Fixed icon display issues when switching between different icon types
Influence:
fix: 设置其他图标类型时正确清除 DCi 图标状态
修复了在设置其他图标类型(QIcon、QStyle::StandardPixmap、
DStyle::StandardPixmap)时未正确清除 DCi 图标状态的问题。这可能导致在不
同图标类型之间切换时出现错误的图标渲染。
这些更改确保在设置非 DCi 图标时,DCi 图标状态被正确重置,以避免不同图
标系统之间的冲突。当设置 DCi 图标时,QAbstractButton 图标被清除以防止
干扰。
Log: 修复在不同图标类型之间切换时的图标显示问题
Influence:
PMS: BUG-337027