fix: correct mouse event handling area for icon items#724
fix: correct mouse event handling area for icon items#724deepin-bot[bot] merged 2 commits intolinuxdeepin:masterfrom
Conversation
The MouseArea was incorrectly placed inside the icon's contentItem, causing mouse events to only be captured within the icon image area rather than the entire delegate item. This led to poor user experience where drag-and-drop and click operations only worked when clicking directly on the icon image, not the surrounding area. Moved the MouseArea from inside the icon's contentItem to be a direct child of the Control's background. This ensures the MouseArea covers the entire delegate area, making drag-and-drop and click operations work consistently across the whole item surface. Log: Fixed issue where drag-and-drop and click operations only worked when clicking directly on app icons Influence: 1. Test drag-and-drop functionality by clicking and dragging from any area within app icon items 2. Verify click operations work consistently across entire icon item surface 3. Test both normal clicks and drag operations to ensure they don't interfere 4. Verify hover states and visual feedback work correctly 5. Test with various icon sizes and delegate configurations fix: 修复图标项鼠标事件处理区域错误 MouseArea 原本错误地放置在图标 contentItem 内部,导致鼠标事件只能在图标 图像区域内被捕获,而不是在整个委托项区域内。这导致了糟糕的用户体验,拖放 和点击操作只有在直接点击图标图像时才有效,而不是在周围区域。 将 MouseArea 从图标的 contentItem 内部移动到 Control 背景的直接子元素。 这确保了 MouseArea 覆盖整个委托区域,使拖放和点击操作在整个项目表面上都 能一致工作。 Log: 修复了拖放和点击操作仅在直接点击应用图标时才有效的问题 Influence: 1. 通过从应用图标项的任何区域点击和拖动来测试拖放功能 2. 验证点击操作在整个图标项表面上都能一致工作 3. 测试正常点击和拖动操作,确保它们不会相互干扰 4. 验证悬停状态和视觉反馈正常工作 5. 使用各种图标大小和委托配置进行测试
update changelog to 2.0.30
|
TAG Bot TAG: 2.0.30 |
Reviewer's GuideAdjusts the MouseArea handling for icon items so it covers the entire control instead of just the icon, and updates the Debian package version to 2.0.30. Sequence diagram for icon click vs drag with new MouseAreasequenceDiagram
actor User
participant IconItemDelegate as IconItemDelegate
participant MouseArea as mouseArea
participant AppIconButton as appIcon
participant Drag as Drag
User->>MouseArea: press(leftButton)
MouseArea->>IconItemDelegate: check dndEnabled
alt dndEnabled and leftButton
MouseArea->>AppIconButton: grabToImage(callback)
AppIconButton-->>MouseArea: result(url)
MouseArea->>Drag: set imageSource(result.url)
end
User-->>MouseArea: release(click)
MouseArea->>MouseArea: onClicked()
alt drag not active
MouseArea->>IconItemDelegate: itemClicked()
else drag active
MouseArea-->>User: drag operation continues
end
Class diagram for updated IconItemDelegate mouse handlingclassDiagram
class IconItemDelegate {
+bool dndEnabled
+void itemClicked()
}
class Control {
}
class MouseArea {
+bool hoverEnabled
+int acceptedButtons
+bool enabled
+object drag_target
+void onPressed(mouse)
+void onClicked()
}
class Column {
}
class AppIconButton {
+void grabToImage(callback)
}
IconItemDelegate --|> Control
IconItemDelegate *-- MouseArea : root_mouseArea
IconItemDelegate *-- Column : contentItem
Column *-- AppIconButton : appIcon
%% Previous structure (for comparison of containment)
class PreviousStructure {
}
PreviousStructure *-- AppIconButton : appIcon
AppIconButton *-- MouseArea : icon_mouseArea
%% New structure
class NewStructure {
}
NewStructure *-- IconItemDelegate : root
IconItemDelegate *-- MouseArea : mouseArea
IconItemDelegate *-- AppIconButton : appIcon
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- Now that the MouseArea is attached to the whole control rather than the icon, consider whether its
enabledstate should also depend onroot.enabled(or similar) so it doesn’t react when the delegate is disabled butdndEnabledhappens to be true. - With the MouseArea filling the parent, verify whether it unintentionally intercepts other mouse interactions (e.g., context menus or other buttons in the delegate) and, if so, consider constraining its
anchorsor usingacceptedButtons/propagateComposedEventsto avoid blocking them.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Now that the MouseArea is attached to the whole control rather than the icon, consider whether its `enabled` state should also depend on `root.enabled` (or similar) so it doesn’t react when the delegate is disabled but `dndEnabled` happens to be true.
- With the MouseArea filling the parent, verify whether it unintentionally intercepts other mouse interactions (e.g., context menus or other buttons in the delegate) and, if so, consider constraining its `anchors` or using `acceptedButtons`/`propagateComposedEvents` to avoid blocking them.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
deepin pr auto review这段代码 diff 显示了对 以下是对这段代码的详细审查意见,包括语法逻辑、代码质量、性能和安全性方面: 1. 语法逻辑与代码逻辑改进点:
2. 代码质量改进点:
建议:
3. 代码性能分析:
4. 代码安全分析:
总结这是一个高质量的修复补丁。
最终建议:
|
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 18202781743, robertkill 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 |
|
/forcemerge |
|
This pr force merged! (status: blocked) |
|
TAG Bot ✅ Tag created successfully 📋 Tag Details
|
Summary by Sourcery
Adjust icon item mouse interaction area and update package version metadata.
Bug Fixes:
Chores: