Describe the bug
Commit 44d1d86c ("Refactor function") introduced a regression in PlaylistTreeWidget::dragMoveEvent that breaks drag-and-drop in the playlist:
- Dragging a file from the file manager onto the playlist no longer loads the file.
- Dragging a playlist item to reorder it (drop between two existing items) is rejected.
Root cause
The refactor inverted the dropTarget null-check logic:
// Before (worked):
if (dropTarget) { /* validate */ }
QTreeWidget::dragMoveEvent(event); // always called when dropTarget is null
// After (broken):
if (!dropTarget) { event->ignore(); return; } // rejects ALL drops on empty areas
When dropTarget is null (empty area or gap between items), event->ignore() is called unconditionally, preventing dropEvent from ever being triggered. Additionally, when dropping an external file directly on an existing item, selectedItems() is empty (no internal item is selected), causing the event to be ignored as well.
To Reproduce
Scenario 1 — External file drop:
- Open YUView
- Drag a video file from the file manager onto the playlist area
- Nothing happens — the file is not loaded
Scenario 2 — Internal reordering:
- Open YUView and load two or more items
- Drag one item to reorder it (drop between two existing items)
- The drop is rejected — the item cannot be placed in the gap between items
Expected behavior
- Dragging a file from the file manager onto the playlist should load it as a new playlist item.
- Dragging a playlist item to the gap between two existing items should reorder it.
Version
- OS: macOS (also affects all platforms)
- Version:
develop branch at a72eb348
- This is not a self-compiled issue; the regression was introduced by commit
44d1d86c in the upstream repository.
Describe the bug
Commit
44d1d86c("Refactor function") introduced a regression inPlaylistTreeWidget::dragMoveEventthat breaks drag-and-drop in the playlist:Root cause
The refactor inverted the
dropTargetnull-check logic:When
dropTargetis null (empty area or gap between items),event->ignore()is called unconditionally, preventingdropEventfrom ever being triggered. Additionally, when dropping an external file directly on an existing item,selectedItems()is empty (no internal item is selected), causing the event to be ignored as well.To Reproduce
Scenario 1 — External file drop:
Scenario 2 — Internal reordering:
Expected behavior
Version
developbranch ata72eb34844d1d86cin the upstream repository.