Skip to content

fix(dock): support Qt 6.10 filter invalidation - #1735

Open
felixonmars wants to merge 1 commit into
linuxdeepin:masterfrom
felixonmars:fix/qt-filter-invalidation
Open

fix(dock): support Qt 6.10 filter invalidation#1735
felixonmars wants to merge 1 commit into
linuxdeepin:masterfrom
felixonmars:fix/qt-filter-invalidation

Conversation

@felixonmars

@felixonmars felixonmars commented Sep 11, 2026

Copy link
Copy Markdown
Member

Support the Qt 6.10 filter-change API in the tray and hover preview models by using endFilterChange(Direction::Both) when available. Retain invalidateFilter() for older Qt versions.

Preserve lazy proxy initialization, filter callback timing, and model signals by invalidating directly without beginFilterChange(). Keep setter ordering and the tray model's public invalidateFilter() slot unchanged.

Log: Support Qt 6.10 in dock proxy models

Summary by Sourcery

Support Qt 6.10 filter invalidation in dock proxy models while preserving compatibility with older Qt versions.

New Features:

  • Add Qt 6.10-compatible filter invalidation to the dock tray and hover preview proxy models.

Bug Fixes:

  • Maintain filter updates for older Qt versions through the existing invalidation behavior.

Chores:

  • Update copyright years in the hover preview proxy model.

@sourcery-ai

sourcery-ai Bot commented Sep 11, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Updates the dock tray and hover-preview proxy models to use Qt 6.10’s bidirectional endFilterChange API with compile-time fallback to invalidateFilter() on older Qt versions, without changing public interfaces or filter-update behavior.

Sequence diagram for Qt-version-aware dock filter invalidation

sequenceDiagram
    participant FilterSetter as FilterSetter
    participant HoverModel as HoverPreviewProxyModel
    participant TrayModel as KSortFilterProxyModel
    participant QtProxy as QSortFilterProxyModel

    FilterSetter->>HoverModel: setFilter(filter, mode)
    HoverModel->>HoverModel: update m_filter and m_filterMode
    alt Qt 6.10 or newer
        HoverModel->>QtProxy: endFilterChange(Direction::Both)
    else Older Qt
        HoverModel->>QtProxy: invalidateFilter()
    end

    FilterSetter->>TrayModel: invalidateFilter()
    alt Qt 6.10 or newer
        TrayModel->>QtProxy: endFilterChange(Direction::Both)
    else Older Qt
        TrayModel->>QtProxy: invalidateFilter()
    end
Loading

File-Level Changes

Change Details Files
Add Qt-version-gated filter invalidation for dock proxy models while preserving existing behavior on older Qt releases.
  • Use endFilterChange(Direction::Both) with Qt 6.10 and newer.
  • Retain invalidateFilter() for pre-6.10 Qt versions.
  • Invalidate directly without beginFilterChange() to preserve initialization, callback timing, setter ordering, and model signals.
panels/dock/taskmanager/hoverpreviewproxymodel.cpp
panels/dock/tray/ksortfilterproxymodel.cpp
Preserve the tray model’s existing public invalidation interface while routing its implementation through the Qt 6.10 API.
  • Keep the invalidateFilter() slot unchanged externally.
  • Call the base proxy’s endFilterChange(Direction::Both) on Qt 6.10 and newer.
panels/dock/tray/ksortfilterproxymodel.cpp

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

BLumia
BLumia previously approved these changes Sep 11, 2026

@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 ✨

Support the Qt 6.10 filter-change API in the tray and hover preview
models by using endFilterChange(Direction::Both) when available.
Retain invalidateFilter() for older Qt versions.

Preserve lazy proxy initialization, filter callback timing, and model
signals by invalidating directly without beginFilterChange(). Keep
setter ordering and the tray model's public invalidateFilter() slot
unchanged.

Log: Support Qt 6.10 in dock proxy models
@deepin-ci-robot

Copy link
Copy Markdown

deepin pr auto review

🤖 AI 代码审查报告

总体评分: 98 分 (通过阈值: 70分)

Pass


📊 总体评价

项目 结果
审查结论 代码审查通过
评分详情 总体评分 98 分,大于 70 分通过阈值,代码质量符合要求。本次变更通过条件编译正确实现了 Qt 6.10 的 filter invalidation API 兼容性支持,代码简洁清晰,无安全漏洞。

🔍 详细分析

1. 语法逻辑 ✅

评价: 优秀 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: 语法正确,逻辑清晰。条件编译结构 (#if/#else/#endif) 使用规范,QT_VERSION_CHECK 宏调用正确,endFilterChange(Direction::Both) 是 Qt 6.10 中 invalidateFilter() 的正确替代 API。两个文件的修改都能在各自目标 Qt 版本下正确编译。


2. 代码质量 ✅

评价: 优秀 ✅ 通过

潜在问题:

  1. panels/dock/taskmanager/hoverpreviewproxymodel.cpp:25 - Qt 6.10 API 变更处缺少注释说明,建议添加注释说明 invalidateFilter() 在 Qt 6.10 中已弃用,需使用 endFilterChange(Direction) 替代
  2. panels/dock/tray/ksortfilterproxymodel.cpp:249 - Qt 6.10 API 变更处缺少注释说明,建议添加注释说明 QSortFilterProxyModel::invalidateFilter() 在 Qt 6.10 中已弃用

建议: 建议在条件编译处添加简短注释,说明 Qt 6.10 中 invalidateFilter() 已弃用、需使用 endFilterChange(Direction) 替代的原因,便于不熟悉 Qt 6.10 API 变更的开发者理解。


3. 代码性能 ✅

评价: 优秀 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: 性能良好,资源使用合理。endFilterChange(Direction::Both) 与 invalidateFilter() 在功能上等价,均为触发过滤模型重新评估,无性能差异。


4. 代码安全 🔒

评价: 优秀 ✅ 通过

🔐 发现 0 个安全漏洞

安全漏洞详情:
✅ 未发现安全漏洞

建议: 存在0个安全漏洞,安全合规。本次变更仅涉及 Qt 模型过滤 API 的版本兼容性处理,不涉及用户输入处理、网络操作、文件系统操作或敏感信息,无安全风险。


💡 改进建议代码示例

// panels/dock/taskmanager/hoverpreviewproxymodel.cpp
void HoverPreviewProxyModel::setFilter(QString filter, enum FilterMode mode)
{
    m_filter = filter;
    m_filterMode = mode;

    // Qt 6.10 中 invalidateFilter() 已弃用,使用 endFilterChange 替代
#if QT_VERSION >= QT_VERSION_CHECK(6, 10, 0)
    endFilterChange(Direction::Both);
#else
    invalidateFilter();
#endif
}

// panels/dock/tray/ksortfilterproxymodel.cpp
void KSortFilterProxyModel::invalidateFilter()
{
    // Qt 6.10 中 invalidateFilter() 已弃用,使用 endFilterChange 替代
#if QT_VERSION >= QT_VERSION_CHECK(6, 10, 0)
    QSortFilterProxyModel::endFilterChange(QSortFilterProxyModel::Direction::Both);
#else
    QSortFilterProxyModel::invalidateFilter();
#endif
}

本报告由 AI 代码审查工具自动生成

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: 18202781743, felixonmars

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

{
#if QT_VERSION >= QT_VERSION_CHECK(6, 10, 0)
QSortFilterProxyModel::endFilterChange(QSortFilterProxyModel::Direction::Both);
#else

@BLumia BLumia Sep 14, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

怪怪的,没有 begin 只有 end。后续我详细测一下。

https://github.com/KDE/kitemmodels/blob/00e7da79f72ce1f4f8d3de91c6a9a6bece3a555b/src/qml/ksortfilterproxymodel.cpp#L311

上游也还没做相关修改。

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.

4 participants