Skip to content

Drag-and-drop in playlist not working #658

@for13to1

Description

@for13to1

Describe the bug

Commit 44d1d86c ("Refactor function") introduced a regression in PlaylistTreeWidget::dragMoveEvent that breaks drag-and-drop in the playlist:

  1. Dragging a file from the file manager onto the playlist no longer loads the file.
  2. 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:

  1. Open YUView
  2. Drag a video file from the file manager onto the playlist area
  3. Nothing happens — the file is not loaded

Scenario 2 — Internal reordering:

  1. Open YUView and load two or more items
  2. Drag one item to reorder it (drop between two existing items)
  3. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions