Fix tray context menus (Quit etc.) not appearing

QApplication mode is required for native PlatformMenuEntry popups;
also fix right-click coordinates being passed relative to the tray
icon instead of the bar window.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Dujsk9jYfxUVLtb5B8eC94
This commit is contained in:
nico
2026-07-28 22:43:24 +02:00
parent 4485846f66
commit e5c1705e3f
2 changed files with 4 additions and 1 deletions

View File

@@ -375,11 +375,13 @@ Variants {
}
MouseArea {
id: trayItemArea
anchors.fill: parent
acceptedButtons: Qt.LeftButton | Qt.RightButton
onClicked: mouse => {
if (mouse.button === Qt.RightButton && modelData.hasMenu) {
modelData.display(bar, mouse.x, mouse.y)
var pos = trayItemArea.mapToItem(bar.contentItem, mouse.x, mouse.y)
modelData.display(bar, pos.x, pos.y)
} else {
modelData.activate()
}

View File

@@ -1,3 +1,4 @@
//@ pragma UseQApplication
import QtQuick
import Quickshell