fix(dock): support Qt 6.10 filter invalidation - #1735
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideUpdates 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 invalidationsequenceDiagram
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
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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
3c2f847 to
fb18e7a
Compare
deepin pr auto review🤖 AI 代码审查报告📊 总体评价
🔍 详细分析1. 语法逻辑 ✅评价: 优秀 ✅ 通过 潜在问题: 建议: 语法正确,逻辑清晰。条件编译结构 (#if/#else/#endif) 使用规范,QT_VERSION_CHECK 宏调用正确,endFilterChange(Direction::Both) 是 Qt 6.10 中 invalidateFilter() 的正确替代 API。两个文件的修改都能在各自目标 Qt 版本下正确编译。 2. 代码质量 ✅评价: 优秀 ✅ 通过 潜在问题:
建议: 建议在条件编译处添加简短注释,说明 Qt 6.10 中 invalidateFilter() 已弃用、需使用 endFilterChange(Direction) 替代的原因,便于不熟悉 Qt 6.10 API 变更的开发者理解。 3. 代码性能 ✅评价: 优秀 ✅ 通过 潜在问题: 建议: 性能良好,资源使用合理。endFilterChange(Direction::Both) 与 invalidateFilter() 在功能上等价,均为触发过滤模型重新评估,无性能差异。 4. 代码安全 🔒评价: 优秀 ✅ 通过
安全漏洞详情: 建议: 存在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 代码审查工具自动生成 |
|
[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. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
| { | ||
| #if QT_VERSION >= QT_VERSION_CHECK(6, 10, 0) | ||
| QSortFilterProxyModel::endFilterChange(QSortFilterProxyModel::Direction::Both); | ||
| #else |
There was a problem hiding this comment.
怪怪的,没有 begin 只有 end。后续我详细测一下。
上游也还没做相关修改。
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:
Bug Fixes:
Chores: