This commit is contained in:
Zacharias-Brohn
2025-10-07 23:22:46 +02:00
parent 0da7e57a64
commit f6d25c98a6
10 changed files with 727 additions and 70 deletions
+6 -45
View File
@@ -3,28 +3,13 @@ pragma ComponentBehavior: Bound
import QtQuick
import Quickshell
import QtQuick.Window // for Window, flags
import qs.Modules
PopupWindow {
id: popup
color: "#FF202020"
property QsMenuHandle menuHandle
property alias entries: menuModel
QsMenuOpener {
id: menu
menu: popup.menuHandle
}
ListModel { id: menuModel }
implicitWidth: contentColumn.implicitWidth + 16
implicitHeight: contentColumn.implicitHeight + 16
Rectangle {
color: "#202020CC"
radius: 4
anchors.fill: parent
}
required property QsMenuOpener trayMenu
Column {
id: contentColumn
@@ -32,11 +17,10 @@ PopupWindow {
spacing: 4
Repeater {
id: repeater
model: menuModel
model: popup.trayMenu.children
Row {
id: entryRow
height: 30
width: parent.implicitWidth
anchors.fill: parent
property var entry: modelData
MouseArea {
anchors.fill: parent
@@ -54,33 +38,10 @@ PopupWindow {
}
Text {
text: entryRow.entry.text
color: "white"
color: "black"
anchors.verticalCenter: parent.verticalCenter
}
}
}
}
function rebuild() {
menuModel.clear()
console.log(menu.children.count)
if (!menu) return
for (let i = 0; i < menu.children.count; ++i) {
let e = menu.children.get(i)
menuModel.append({
text: e.text,
icon: e.icon,
triggered: e.triggered,
entryObject: e
})
}
}
onMenuHandleChanged: rebuild
Connections {
target: menu
function onCountChanged() {
popup.rebuild
}
}
}