quickshell: fix tray icon right-click by splitting MouseAreas
Hover-only MouseArea (Qt.NoButton) for switch-on-hover, separate click MouseArea for right-click menus. Prevents hover tracking from consuming click events. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
db87df3ba3
commit
155d9fa795
1 changed files with 15 additions and 11 deletions
|
|
@ -864,8 +864,22 @@ in
|
|||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||||
hoverEnabled: true
|
||||
acceptedButtons: Qt.NoButton
|
||||
onEntered: {
|
||||
if (bar.activeDropdown && modelData.hasMenu && !(bar.activeDropdown === contextMenu && contextMenu.trayItem === modelData)) {
|
||||
bar.toggleDropdown(contextMenu, function() {
|
||||
let pos = parent.mapToItem(bar.contentItem, parent.width / 2, 0);
|
||||
contextMenu.dropdownX = pos.x;
|
||||
contextMenu.trayItem = modelData;
|
||||
menuOpener.menu = modelData.menu;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||||
onClicked: (event) => {
|
||||
if (event.button === Qt.RightButton && modelData.hasMenu) {
|
||||
bar.toggleDropdown(contextMenu, function() {
|
||||
|
|
@ -878,16 +892,6 @@ in
|
|||
modelData.activate();
|
||||
}
|
||||
}
|
||||
onEntered: {
|
||||
if (bar.activeDropdown && modelData.hasMenu && !(bar.activeDropdown === contextMenu && contextMenu.trayItem === modelData)) {
|
||||
bar.toggleDropdown(contextMenu, function() {
|
||||
let pos = parent.mapToItem(bar.contentItem, parent.width / 2, 0);
|
||||
contextMenu.dropdownX = pos.x;
|
||||
contextMenu.trayItem = modelData;
|
||||
menuOpener.menu = modelData.menu;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue