fix: improve window grouping and drag reordering in dock#1478
fix: improve window grouping and drag reordering in dock#1478wjyrich wants to merge 1 commit intolinuxdeepin:masterfrom
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 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 |
deepin pr auto review这段代码主要实现了任务栏(Dock)中应用窗口的拖拽排序和分组功能。以下是对代码的详细审查和改进建议: 1. 语法与逻辑优点:
潜在问题与改进建议:
2. 代码质量优点:
改进建议:
3. 代码性能
4. 代码安全
总结这段代码整体上是健壮的,正确实现了拖拽排序和分组功能。主要的改进空间在于:
建议优先考虑重构 |
There was a problem hiding this comment.
Pull request overview
Fixes dock task manager ordering issues by making drag-reordering update the underlying models correctly in window-split mode, and by re-grouping windows by application when split mode is turned off.
Changes:
- Add a QML-callable
moveItem(from,to)API and route it to the underlying dock global model. - Improve new-window insertion to locate the rightmost existing window for an app even if windows aren’t consecutive.
- Add regrouping on
windowSplitChangedand propagaterowsMovedso views stay in sync during model moves.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| panels/dock/taskmanager/taskmanager.h | Exposes moveItem(from,to) to QML. |
| panels/dock/taskmanager/taskmanager.cpp | Forwards moveItem() to DockGlobalElementModel. |
| panels/dock/taskmanager/package/TaskManager.qml | Uses moveItem() for drag-reorder when window-split is enabled. |
| panels/dock/taskmanager/dockitemmodel.cpp | Mirrors rowsMoved from the source model to keep the proxy/view updated. |
| panels/dock/taskmanager/dockglobalelementmodel.h | Declares moveItem() and regroup helper. |
| panels/dock/taskmanager/dockglobalelementmodel.cpp | Implements item moving + regrouping; improves “insert after last window of app” logic. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| connect(sourceModel(), &QAbstractItemModel::rowsMoved, this, [this](const QModelIndex &parent, int start, int end, const QModelIndex &destination, int row) { | ||
| if (parent.isValid() || m_isUpdating) | ||
| return; | ||
| beginMoveRows(QModelIndex(), start, end, QModelIndex(), row); | ||
| endMoveRows(); |
There was a problem hiding this comment.
This rowsMoved handler’s lambda takes a destination parameter that is never used. If the project builds with -Werror=unused-parameter, this will fail compilation. Either remove the unused parameter from the lambda signature or mark it unused (e.g., via Q_UNUSED(destination)).
1. Fixed window grouping logic to correctly group windows by application after drag reordering 2. Enhanced window insertion algorithm to find the last window of an app even when windows are not consecutive 3. Added moveItem() method to properly handle item movement in the model 4. Connected windowSplitChanged signal to trigger re-grouping when window split mode changes 5. Updated QML drag handlers to use moveItem() when window split is enabled Log: Fixed dock task manager window grouping issues after drag reordering Influence: 1. Test dragging windows in dock when window split is disabled - windows should stay grouped by application 2. Test dragging windows in dock when window split is enabled - windows should move independently 3. Verify that window grouping is maintained after toggling window split mode 4. Test drag and drop reordering of both individual windows and application groups 5. Verify that the dock maintains correct ordering after multiple drag operations fix: 修复任务管理器停靠栏窗口分组和拖拽重排序问题 1. 修复窗口分组逻辑,确保拖拽重排序后窗口能正确按应用程序分组 2. 改进窗口插入算法,即使窗口不连续也能找到应用程序的最后一个窗口 3. 添加 moveItem() 方法以正确处理模型中的项目移动 4. 连接 windowSplitChanged 信号,在窗口分割模式更改时触发重新分组 5. 更新 QML 拖拽处理程序,在窗口分割启用时使用 moveItem() 方法 Log: 修复停靠栏任务管理器拖拽重排序后的窗口分组问题 Influence: 1. 测试在窗口分割禁用时拖拽停靠栏中的窗口 - 窗口应按应用程序保持分组 2. 测试在窗口分割启用时拖拽停靠栏中的窗口 - 窗口应独立移动 3. 验证切换窗口分割模式后窗口分组是否保持正确 4. 测试单个窗口和应用程序组的拖拽重排序功能 5. 验证多次拖拽操作后停靠栏是否保持正确的排序 PMS: BUG-343469
|
TAG Bot New tag: 2.0.31 |
Log: Fixed dock task manager window grouping issues after drag reordering
Influence:
fix: 修复任务管理器停靠栏窗口分组和拖拽重排序问题
Log: 修复停靠栏任务管理器拖拽重排序后的窗口分组问题
Influence:
PMS: BUG-343469