Repository navigation
fix(exhibition): use emblem-checked icon for in-app notification - #737
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThe example notification now uses Sequence diagram for theme-aware notification icon resolutionsequenceDiagram
participant User
participant NotifyQml
participant DTK
participant DciIcon
participant DCITheme
participant QIconTheme
User->>NotifyQml: Click notification example
NotifyQml->>DTK: sendMessage(control, message, emblem-checked)
DTK->>DciIcon: Resolve emblem-checked
alt DCI theme installed
DciIcon->>DCITheme: Find emblem-checked.dci
DCITheme-->>DciIcon: Theme-specific icon
else DCI theme unavailable
DciIcon->>QIconTheme: fromTheme(emblem-checked)
QIconTheme-->>DciIcon: Standard theme icon
end
DciIcon-->>DTK: Render resolved icon
DTK-->>User: Show success notification
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
Hi @zqq-dora. Thanks for your PR. I'm waiting for a linuxdeepin member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
The in-app notification example passed iconName="checked" which does not exist in the built-in DCI icon set or any system DCI icon theme. "checked" is also not a freedesktop standard icon name, so the QIcon fallback cannot resolve it either, resulting in an incorrect icon. Change to "emblem-checked", a freedesktop standard icon name that exists in all system DCI icon themes. The resolution chain works as: DCI theme (emblem-checked.dci) -> QIcon fallback (emblems/24/). Also update the SPDX copyright year from 2022 to 2022-2026.
39da8fc to
e066444
Compare
| source: "qrc:/assets/popup/nointeractive.svg" | ||
| onClicked: { | ||
| DTK.sendMessage(control, "成功添加到"校园名谣"", "checked") | ||
| DTK.sendMessage(control, "成功添加到"校园名谣"", "emblem-checked") |
|
有的。 |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 18202781743, zqq-dora 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 |
f12c5d3
into
linuxdeepin:v25-flowstyle
Background
The in-app notification example (
examples/exhibition/Notify.qml) passediconName="checked"when triggering the "成功添加到校园名谣" bubble message. This icon name does not exist in the library's built-in DCI icon set (built-in-icons), nor does a correspondingchecked.dciexist in any system DCI icon theme (/usr/share/dsg/icons/<theme>/). After DCI resolution fails,DciIconfalls back viafallbackToQIcontoQIcon::fromTheme("checked"), butcheckedis not a freedesktop standard icon name, so the standard icon theme cannot resolve it either, ultimately rendering an incorrect icon.Changes
examples/exhibition/Notify.qml
DTK.sendMessage(control, "成功添加到"校园名谣"", "checked")from"checked"to"emblem-checked".emblem-checkedis a standard name in the freedesktop icon naming specification, andemblem-checked.dciexists in all system DCI icon themes (flow, bloom, bloom-dark, bloom-classic, vintage, square, nirvana, hazy-color, organic-glass, origin). The resolution chain is: first search foremblem-checked.dciin the DCI theme, and render it according to the current theme if found; if the DCI theme is not installed,fallbackToQIcon(enabled by default) falls back toQIcon::fromTheme("emblem-checked"), resolving from theemblems/24/directory of QIcon icon themes (e.g., bloom, bloom-dark). This icon is theme-independent and does not rely on library built-in icon resources.Effect
emblem-checkedicon corresponding to the current theme.Only example code (
examples/exhibition/) is modified; Qt5/Qt6 control implementations are not affected.背景
应用内通知示例(
examples/exhibition/Notify.qml)在触发「成功添加到校园名谣」气泡消息时,传入iconName="checked"。该图标名在库的内置 DCI 图标集(built-in-icons)中不存在,在系统 DCI 图标主题(/usr/share/dsg/icons/<theme>/)中也不存在对应的checked.dci。DciIcon解析失败后,通过fallbackToQIcon兜底到QIcon::fromTheme("checked"),而checked并非 freedesktop 标准图标名,标准图标主题同样无法解析,最终渲染出错误的图标。改动
examples/exhibition/Notify.qml
DTK.sendMessage(control, "成功添加到"校园名谣"", "checked")中的图标名从"checked"改为"emblem-checked"。emblem-checked是 freedesktop 图标命名规范中的标准名称,同时存在于全部系统 DCI 图标主题(flow、bloom、bloom-dark、bloom-classic、vintage、square、nirvana、hazy-color、organic-glass、origin)的emblem-checked.dci中。解析链路为:先在 DCI 主题中查找emblem-checked.dci,命中则按当前主题渲染;若 DCI 主题未安装,fallbackToQIcon(默认开启)兜底到QIcon::fromTheme("emblem-checked"),在 QIcon 图标主题(如 bloom、bloom-dark 等)的emblems/24/目录中解析。该图标与主题无关,不依赖库内置图标资源。效果
emblem-checked图标。emblem-checked。仅修改示例代码(
examples/exhibition/),不涉及 Qt5/Qt6 控件实现。Summary by Sourcery
Correct the exhibition notification’s success icon by replacing the unresolved
checkedname with the standardemblem-checkedicon.Bug Fixes:
emblem-checkedicon name so the exhibition notification displays the correct success icon across available themes and fallback icon resolution.Chores: