fix: when drag app to another app from folder,add animation and auto-move with folders.#574
Conversation
Reviewer's GuideThis PR wraps the folder proxy with a SortProxyModel to enforce stable ordering, adds eased item-move transitions in grid views, and implements auto-move-on-drag behavior within folders via drag event handlers and a timed preview slider. Sequence Diagram: App Auto-Move and Sorting during Drag in FoldersequenceDiagram
actor User
participant DDA as "DelegateDropArea"
participant FDAT as "FolderDragApplyTimer"
participant FolderLogic as "Folder Logic (dropOnItem, SortProxyModel)"
User->>+DDA: Drags item (onEntered)
DDA->>FDAT: set dragId, restart()
User->>DDA: Moves item (onPositionChanged)
DDA->>FDAT: update dragId, currentDropX
opt dragId is set and timer not running
DDA->>FDAT: restart()
end
loop Timer Ticks (interval: 500ms)
FDAT->>FDAT: onTriggered()
alt dragId is set AND item is near edge (op != 0)
FDAT->>FolderLogic: dropOnItem(dragId, targetItemId, op) // Preview move
FolderLogic->>FolderLogic: sortProxyModel.sort(0)
end
end
alt User drops item
User->>DDA: Drops item (onDropped)
DDA->>FDAT: stop(), clear dragId
DDA->>FolderLogic: dropOnItem(dragId, targetItemId, op) // Final move
FolderLogic->>FolderLogic: sortProxyModel.sort(0)
else User drags item out
User->>DDA: Drags item out (onExited)
DDA->>FDAT: stop(), clear dragId
end
DDA-->>-User: Interaction feedback
Class Diagram: Model Sorting and Drag/Drop Logic in FolderGridViewPopup.qmlclassDiagram
class MultipageSortFilterProxyModel {
<<QML Component>>
id: folderProxyModel
+filterOnlyMode: bool // Modified
}
class SortProxyModel {
<<QML Component (New)>>
id: sortProxyModel
+sourceModel: MultipageSortFilterProxyModel
+sortRole: int
+Component.onCompleted() void
+sort(index: int) void
}
class GridViewInFolder {
<<QML Component>>
+model: SortProxyModel // Changed
+itemMove: Transition // Updated configuration (e.g., duration: 200, easing: OutQuad)
}
class DelegateDropArea {
<<QML Component>>
+onEntered(drag: DragEvent) void // New handler
+onPositionChanged(drag: DragEvent) void // New handler
+onExited() void // New handler
+onDropped(drop: DropEvent) void // Logic modified for timer & sorting
}
class FolderDragApplyTimer {
<<QML Component (New, in DelegateDropArea)>>
id: folderDragApplyTimer
+interval: int
+dragId: string
+currentDropX: real
+onTriggered() void
}
SortProxyModel --|> MultipageSortFilterProxyModel : uses as sourceModel
GridViewInFolder --|> SortProxyModel : uses as model
DelegateDropArea o-- FolderDragApplyTimer : contains
Class Diagram: Item Move Transition Propagation in GridViewContainer.qmlclassDiagram
class GridViewContainer {
<<QML Component>>
+itemMove: Transition // New property
}
class InnerGridView {
<<QML Component (child of GridViewContainer)>>
+displaced: Transition // New binding (uses root.itemMove)
+move: Transition // New binding (uses root.itemMove)
+moveDisplaced: Transition // New binding (uses root.itemMove)
}
GridViewContainer o-- InnerGridView : contains
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey @wjyrich - I've reviewed your changes - here's some feedback:
- Consider extracting the itemMove Transition into a shared property or style instead of duplicating the same animation block in both grid views for easier maintenance.
- You’re instantiating a Timer in every DelegateDropArea to handle drag previews—centralize that logic at the popup level to avoid creating multiple timers and simplify state management.
- The single SortProxyModel is used by both grid views and may cause cross-view reordering issues—consider giving each view its own proxy instance to isolate their sorting behavior.
Here's what I looked at during the review
- 🟡 General issues: 3 issues found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
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代码审查意见:
以上是针对代码审查意见的总结,希望能够对您有所帮助。 |
…move with folders. as title. PMS-BUG-288847
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: BLumia, 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 |
as title.
PMS-BUG-288847
Summary by Sourcery
Improve folder grid drag-and-drop by adding sorted models, consistent move animations, and timed edge-triggered auto-move previews
New Features:
Bug Fixes:
Enhancements: