-
Notifications
You must be signed in to change notification settings - Fork 55
feat: add sorting to tray items #1279
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThe PR configures DDT.SortFilterProxyModel in the tray component to sort items by their visual index in ascending order, ensuring stable and predictable icon ordering. Class diagram for updated DDT.SortFilterProxyModel sorting propertiesclassDiagram
class DDT.SortFilterProxyModel {
+sortRoleName: string
+sortOrder: enum
}
DDT.SortFilterProxyModel <|-- DDT.TraySortOrderModel
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 18202781743, wjyrich 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 |
Added sortRoleName and sortOrder properties to DDT.SortFilterProxyModel to enable proper sorting of tray items by visual index in ascending order. This ensures that tray icons are displayed in a consistent and predictable sequence, improving the user experience by maintaining stable icon positions. feat: 为托盘项添加排序功能 在 DDT.SortFilterProxyModel 中添加了 sortRoleName 和 sortOrder 属性,以 支持按视觉索引升序排列托盘项。这确保了托盘图标以一致且可预测的顺序显示, 通过保持稳定的图标位置来改善用户体验。 Pms: BUG-288745
c29825d to
afd1a15
Compare
deepin pr auto review我来审查这段代码并提供改进建议: 语法逻辑
代码质量
代码性能
代码安全
改进建议AppletItem {
// ... 其他代码 ...
// 建议添加常量定义
readonly property string STASHED_SECTION_TYPE: "stashed"
Rectangle {
// ... 其他属性 ...
model: DDT.SortFilterProxyModel {
sourceModel: DDT.TraySortOrderModel
// 已有的排序配置很好
sortRoleName: "visualIndex"
sortOrder: Qt.AscendingOrder
// 改进后的filterRowCallback,添加注释和空值检查
filterRowCallback: (sourceRow, sourceParent) => {
if (!sourceModel) return false
let index = sourceModel.index(sourceRow, 0, sourceParent)
if (!index.isValid) return false
// 只保留类型为"stashed"的项
return sourceModel.data(index, DDT.TraySortOrderModel.SectionTypeRole) === STASHED_SECTION_TYPE
}
}
}
}这些建议可以提高代码的可维护性、健壮性和可读性,同时保持原有功能不变。 |
Added sortRoleName and sortOrder properties to DDT.SortFilterProxyModel to enable proper sorting of tray items by visual index in ascending order. This ensures that tray icons are displayed in a consistent and predictable sequence, improving the user experience by maintaining stable icon positions.
feat: 为托盘项添加排序功能
在 DDT.SortFilterProxyModel 中添加了 sortRoleName 和 sortOrder 属性,以 支持按视觉索引升序排列托盘项。这确保了托盘图标以一致且可预测的顺序显示,
通过保持稳定的图标位置来改善用户体验。
Pms: BUG-288745
Summary by Sourcery
Enable proper sorting of tray items by visual index in ascending order to maintain stable icon positions and improve user experience
New Features:
Enhancements: