Skip to content

Commit

Permalink
skins/QMLDemo: Allow cloning between decks/samplers via DnD
Browse files Browse the repository at this point in the history
  • Loading branch information
Holzhaus committed Jun 20, 2021
1 parent 47e9ab0 commit 297cfee
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
14 changes: 14 additions & 0 deletions res/skins/QMLDemo/Deck.qml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,20 @@ Item {
property bool minimized: false
property var deckPlayer: Mixxx.PlayerManager.getPlayer(group)

Drag.active: dragArea.drag.active
Drag.dragType: Drag.Automatic
Drag.supportedActions: Qt.CopyAction
Drag.mimeData: {
"mixxx/player": this.group
}

MouseArea {
id: dragArea

anchors.fill: root
drag.target: root
}

Skin.SectionBackground {
anchors.fill: parent
}
Expand Down
5 changes: 5 additions & 0 deletions res/skins/QMLDemo/Mixxx/PlayerDropArea.qml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ DropArea {
property var player: Mixxx.PlayerManager.getPlayer(group)

onDropped: {
if (drop.formats.includes("mixxx/player")) {
const group = drop.getDataAsString("mixxx/player");
console.warn("Drag from group " + group);
player.cloneFromGroup(group);
}
if (drop.hasUrls) {
let url = drop.urls[0];
console.log("Dropped URL '" + url + "' on deck " + group);
Expand Down
13 changes: 13 additions & 0 deletions res/skins/QMLDemo/Sampler.qml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,19 @@ Rectangle {
return Qt.darker(root.deckPlayer.color, 2);
}
implicitHeight: gainKnob.height + 10
Drag.active: dragArea.drag.active
Drag.dragType: Drag.Automatic
Drag.supportedActions: Qt.CopyAction
Drag.mimeData: {
"mixxx/player": this.group
}

MouseArea {
id: dragArea

anchors.fill: root
drag.target: root
}

Skin.SectionBackground {
anchors.fill: parent
Expand Down

0 comments on commit 297cfee

Please sign in to comment.