Skip to content

Drag and drop support for Albums Context View applet

Tuomas Nurmi requested to merge nurmi/amarok:contextviewAlbumDragnDrop into master

KF5 version of Albums context view applet has so far lacked any support for drag and drop (a feature that I used extensively in earlier versions, e.g. to add more songs from the currently playing artist to a dynamic playlist).

Due to some oddities in TreeView in QtQuick.Controls 1, a clean reimplementation of the same functionality is surprisingly challenging. I didn't find a direct way to both keep the selection functionality of the TreeView intact, and have a drag functionality, since there doesn't seem to be a way to hook into TreeView's internal MouseArea's 'pressed' signal, and somewhy selection stops working if some other MouseArea receives the MouseEvent first, even if rejected and propagation enabled.

However, the onPressAndHold handler of the TreeView could be used to create fluent-enough-for-me drag and drop experience. EDIT: As a rough workaround, shortened the pressAndHoldInterval of the TreeView's internal MouseArea. Not the cleanest solution, but the applet doesn't have any other usage of the signal, so at least it doesn't affect anything else.

Edited by Tuomas Nurmi

Merge request reports