Skip to content

fix: show correct icons in search results and refresh on icon change - #3435

Open
Fire-dtx wants to merge 1 commit into
linuxdeepin:masterfrom
Fire-dtx:opt_master_icon_search
Open

Fire-dtx wants to merge 1 commit into
linuxdeepin:masterfrom
Fire-dtx:opt_master_icon_search

Conversation

@Fire-dtx

@Fire-dtx Fire-dtx commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor
  • Add SearchIconSourceRole to expose iconSource (file://, qrc:/, resolved URLs) alongside the existing DecorationRole icon name, matching the icon binding pattern used by HomePage/SecondPage/DccEditorItem.
  • SearchBar.qml delegate now binds icon.source: model.iconSource so non-theme-icon entries render correctly instead of falling back to a broken or missing icon.
  • Extract iconObject() helper: use the search entry's own icon when set, fall back to the topmost ancestor icon otherwise.
  • Connect DccObject::iconChanged in DccManager and add refreshIcon() to SearchModel/SearchSourceModel so dynamically changed icons update search results via dataChanged without resetting filter/highlight.

pms: BUG-372171

Summary by Sourcery

Fix search result icon rendering and update icons dynamically when DCC object icons change.

New Features:

  • Expose resolved icon sources in search model roles so search results can render file and resource icons correctly.

Bug Fixes:

  • Show each search result's own icon when available, with ancestor icons used only as fallback.
  • Refresh visible search result icons when their associated objects change without resetting search state.

- Add SearchIconSourceRole to expose iconSource (file://, qrc:/, resolved
  URLs) alongside the existing DecorationRole icon name, matching the
  icon binding pattern used by HomePage/SecondPage/DccEditorItem.
- SearchBar.qml delegate now binds icon.source: model.iconSource so
  non-theme-icon entries render correctly instead of falling back to a
  broken or missing icon.
- Extract iconObject() helper: use the search entry's own icon when set,
  fall back to the topmost ancestor icon otherwise.
- Connect DccObject::iconChanged in DccManager and add refreshIcon() to
  SearchModel/SearchSourceModel so dynamically changed icons update
  search results via dataChanged without resetting filter/highlight.

pms: BUG-372171
@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Fire-dtx

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@sourcery-ai

sourcery-ai Bot commented Aug 25, 2026

Copy link
Copy Markdown

Reviewer's Guide

Search results now select icons using the same own-icon/fallback-ancestor behavior as other pages, expose the resolved icon source to QML, and refresh affected delegates through targeted dataChanged signals when an object’s icon changes.

Sequence diagram for refreshing search result icons

sequenceDiagram
    participant DccObject
    participant DccManager
    participant SearchModel
    participant SearchSourceModel
    participant SearchBar

    DccObject->>DccManager: iconChanged()
    DccManager->>SearchModel: refreshIcon(obj)
    SearchModel->>SearchSourceModel: refreshIcon(obj)
    SearchSourceModel-->>SearchSourceModel: iconObject()
    SearchSourceModel-->>SearchBar: dataChanged(DecorationRole, SearchIconSourceRole)
    SearchBar->>SearchBar: icon.source = model.iconSource
Loading

Flow diagram for selecting search result icons

flowchart LR
    Entry[Search result entry] --> Own{Own icon set?}
    Own -->|Yes| ObjectIcon[Entry icon]
    Own -->|No| AncestorIcon[Topmost ancestor icon]
    ObjectIcon --> Roles[DecorationRole and iconSource]
    AncestorIcon --> Roles
    Roles --> Delegate[SearchBar delegate]
    Delegate --> Render[Render icon.name and icon.source]
Loading

File-Level Changes

Change Details Files
Expose and bind each search result’s resolved icon source so QML can render file, resource, and URL-based icons correctly.
  • Added a search-model role named iconSource.
  • Updated the search delegate to bind both icon name and icon source.
  • Changed icon selection to prefer the result object’s icon and otherwise use the topmost ancestor’s icon.
src/dde-control-center/searchmodel.cpp
src/dde-control-center/searchmodel.h
src/dde-control-center/plugin/SearchBar.qml
Propagate runtime icon changes to visible search results without rebuilding search state.
  • Connected every managed object’s iconChanged signal and disconnected it on removal.
  • Added manager-to-search refresh forwarding.
  • Emitted targeted dataChanged updates for entries using the changed object’s own or fallback ancestor icon.
src/dde-control-center/dccmanager.cpp
src/dde-control-center/dccmanager.h
src/dde-control-center/searchmodel.cpp
src/dde-control-center/searchmodel.h

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@deepin-bot

deepin-bot Bot commented Sep 10, 2026

Copy link
Copy Markdown

TAG Bot

New tag: 6.1.106
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #3497

@deepin-bot

deepin-bot Bot commented Sep 11, 2026

Copy link
Copy Markdown

TAG Bot

New tag: 6.1.107
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #3503

@deepin-bot

deepin-bot Bot commented Sep 23, 2026

Copy link
Copy Markdown

TAG Bot

New tag: 6.1.109
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #3545

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants