Skip to content

Commit

Permalink
26583: Percussion Pads context menu refinements
Browse files Browse the repository at this point in the history
  • Loading branch information
krasko78 committed Feb 19, 2025
1 parent af80582 commit 8e2b207
Showing 1 changed file with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ Column {

property bool padSwapActive: false

function openFooterContextMenu() {
function openFooterContextMenu(pos) {
if (!root.padModel) {
return
}
menuLoader.toggleOpened(root.padModel.footerContextMenuItems)
menuLoader.show(pos, root.padModel.footerContextMenuItems)
}

Item {
Expand All @@ -67,7 +67,8 @@ Column {
}

if (event.button === Qt.RightButton) {
root.openFooterContextMenu()
let pos = menuLoader.parent.mapFromItem(mouseArea, event.x, event.y)
root.openFooterContextMenu(pos)
return
}

Expand Down Expand Up @@ -177,8 +178,9 @@ Column {

acceptedButtons: Qt.LeftButton | Qt.RightButton

onClicked: {
root.openFooterContextMenu()
onPressed: function(event) {
let pos = menuLoader.parent.mapFromItem(footerMouseArea, event.x, event.y)
root.openFooterContextMenu(pos)
}
}

Expand Down Expand Up @@ -218,13 +220,13 @@ Column {

text: Boolean(root.padModel) ? root.padModel.midiNote : ""
}
}

StyledMenuLoader {
id: menuLoader
ContextMenuLoader {
id: menuLoader

onHandleMenuItem: function(itemId) {
root.padModel.handleMenuItem(itemId)
}
onHandleMenuItem: function(itemId) {
root.padModel.handleMenuItem(itemId)
}
}
}

0 comments on commit 8e2b207

Please sign in to comment.