Commit b178a28
fix: optimize fullscreen launcher item sorting initialization
1. Replaced Component.onCompleted with sortColumn property in
FullscreenFrame.qml for ItemArrangementProxyModel
2. Added setSortColumn method to SortProxyModel to enable declarative
sorting in QML
3. Modified SortProxyModel to reorder items when sortColumn changes if
source model is already populated
4. Added conditional enabling of itemMoveTransition in FullscreenFrame
grid view Component.onCompleted
Log: Improved fullscreen launcher item sorting performance and stability
fix: 优化全屏启动器项目排序初始化
1. 在 FullscreenFrame.qml 中将 ItemArrangementProxyModel 的
Component.onCompleted 替换为 sortColumn 属性
2. 为 SortProxyModel 添加 setSortColumn 方法以支持在 QML 中声明式排序
3. 修改 SortProxyModel 在 sortColumn 变化时重新排序项目(如果源模型已
填充)
4. 在 FullscreenFrame 网格视图的 Component.onCompleted 中添加条件启用
sort(0)时,reorder() 会发出 beginMoveRows/endMoveRows 信号,与 GridView 的 displaced/move 动画冲突
根本解决方案:让排序在 setSourceModel() 的 beginResetModel/endResetModel 阶段就完成,这样视图第一次看到数据时就已经是排好序的,不会产生任何 move 信号。
做法:给 SortProxyModel 增加 sortColumn 的 Q_PROPERTY,在 QML 中声明式地设置 sortColumn: 0。QML 引擎会先设置简单值属性(sortColumn、sortRole),再设置复杂对象属性(sourceModel)。这样 rebuildRowMap() 执行m_sortColumn 已经是 0,数据在 reset 阶段就排好了。
Log: 改进全屏启动器项目排序性能和稳定性1 parent a3bd6dd commit b178a28
3 files changed
Lines changed: 26 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
419 | 419 | | |
420 | 420 | | |
421 | 421 | | |
422 | | - | |
423 | | - | |
424 | | - | |
| 422 | + | |
425 | 423 | | |
426 | 424 | | |
427 | 425 | | |
| |||
666 | 664 | | |
667 | 665 | | |
668 | 666 | | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
669 | 670 | | |
670 | 671 | | |
671 | 672 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
196 | 196 | | |
197 | 197 | | |
198 | 198 | | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
199 | 217 | | |
200 | 218 | | |
201 | 219 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
| 33 | + | |
| 34 | + | |
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
38 | 39 | | |
| 40 | + | |
39 | 41 | | |
40 | 42 | | |
41 | 43 | | |
| |||
60 | 62 | | |
61 | 63 | | |
62 | 64 | | |
| 65 | + | |
63 | 66 | | |
64 | 67 | | |
65 | 68 | | |
| |||
0 commit comments