fix: refresh window icons on icon theme change#302
Merged
mhduiy merged 1 commit intolinuxdeepin:masterfrom Feb 3, 2026
Merged
Conversation
1. Added code to refresh window icons when icon theme changes 2. Iterates through all top-level windows and re-sets their icons 3. This ensures window icons are properly updated after theme switch 4. Fixes issue where window icons might not refresh after theme change fix: 修复图标主题变更时窗口图标刷新问题 1. 添加代码在图标主题变更时刷新窗口图标 2. 遍历所有顶层窗口并重新设置其图标 3. 确保主题切换后窗口图标能正确更新 4. 修复主题变更后窗口图标可能不刷新的问题 PMS: BUG-271403 PMS: BUG-326433 PMS: BUG-321407
Contributor
deepin pr auto review这段代码的目的是在图标主题变更时( 1. 代码逻辑与功能
2. 代码质量 (C++ & Qt 规范)
3. 代码性能
4. 代码安全
5. 改进后的代码建议假设 // 刷新窗口图标
// 使用 const 引用避免列表拷贝
const QWindowList &list = QGuiApplication::topLevelWindows();
// 使用基于范围的 for 循环 (C++11),更简洁安全
for (QWindow *window : list) {
if (window) {
// 注意:如果底层实现比较指针地址,这行代码可能无效。
// 如果需要强制刷新,可能需要先 setIcon(QIcon()) 再 setIcon(originalIcon)
window->setIcon(window->icon());
}
}6. 进一步的思考(关于逻辑有效性)如果上述代码在实际运行中没有效果(因为 // 保存原始图标
QIcon originalIcon = window->icon();
// 先设置为空图标,强制清除状态
window->setIcon(QIcon());
// 重新设置原始图标,强制触发更新
window->setIcon(originalIcon);总结: |
18202781743
approved these changes
Feb 3, 2026
Contributor
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 18202781743, mhduiy 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 |
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.
fix: 修复图标主题变更时窗口图标刷新问题
PMS: BUG-271403
PMS: BUG-326433
PMS: BUG-321407