From f29efc98ade6422e158e876ecd24380d86cb71ac Mon Sep 17 00:00:00 2001 From: yeshanshan Date: Thu, 23 Jul 2026 14:30:32 +0800 Subject: [PATCH] fix: resolve missing icon on first drag in treeland MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The issue occurred because under the treeland environment, the drag icon was not displayed during the first drag attempt. This was due to incorrectly setting `Drag.active` before the image grab operation completed. The fix moves the drag activation logic to occur only after the image is successfully grabbed via the callback, and explicitly deactivates drag when the grab fails or is not ready. Log: Fixed first drag icon not showing under treeland Influence: 1. Test dragging quick panel items in treeland and verify icon appears on first drag 2. Verify drag behavior remains correct in other desktop environments (e.g., X11) 3. Test drag with various item types and positions 4. Verify no regressions in drag cancellation or re-drag scenarios fix: 修复treeland下首次拖拽不显示图标问题 在treeland环境下,首次拖拽时拖拽图标未能显示。原因是在图像截取操作完成前 就错误地设置了 `Drag.active` 状态。修复方案是仅在图像截取成功后的回调函 数中激活拖拽,并在截取失败或未就绪时显式取消拖拽。 Log: 修复treeland下首次拖拽图标不显示的问题 Influence: 1. 在treeland环境下测试拖拽快速面板项目,验证首次拖拽时图标正常显示 2. 验证其他桌面环境(如X11)下拖拽行为仍然正确 3. 测试不同项目类型和位置的拖拽功能 4. 验证拖拽取消或重新拖拽场景无回归问题 PMS: BUG-339333 --- panels/dock/tray/quickpanel/DragItem.qml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/panels/dock/tray/quickpanel/DragItem.qml b/panels/dock/tray/quickpanel/DragItem.qml index 7db47f8c8..24e30ad93 100644 --- a/panels/dock/tray/quickpanel/DragItem.qml +++ b/panels/dock/tray/quickpanel/DragItem.qml @@ -144,9 +144,11 @@ Item { console.log("grab to image", result.url) draggingImage = result.url + Qt.callLater(function() { dragItem.Drag.active = true }) }) + } else { + dragItem.Drag.active = false } - dragItem.Drag.active = active } } }