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 {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
|
||||||
hoverEnabled: true
|
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) => {
|
onClicked: (event) => {
|
||||||
if (event.button === Qt.RightButton && modelData.hasMenu) {
|
if (event.button === Qt.RightButton && modelData.hasMenu) {
|
||||||
bar.toggleDropdown(contextMenu, function() {
|
bar.toggleDropdown(contextMenu, function() {
|
||||||
|
|
@ -878,16 +892,6 @@ in
|
||||||
modelData.activate();
|
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