simplify tray item
This commit is contained in:
parent
fe8261f7af
commit
3c3fe368bc
5 changed files with 52 additions and 55 deletions
49
modules/bar/components/tray/TrayMenu.qml
Normal file
49
modules/bar/components/tray/TrayMenu.qml
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
pragma ComponentBehavior: Bound
|
||||
|
||||
import qs.components
|
||||
import qs.config
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import Quickshell
|
||||
import Quickshell.Widgets
|
||||
|
||||
StyledPopupWindow {
|
||||
id: window
|
||||
|
||||
required property QsMenuOpener menuOpener
|
||||
|
||||
content: ColumnLayout {
|
||||
spacing: 4
|
||||
Repeater {
|
||||
model: window.menuOpener.children.values
|
||||
delegate: Loader {
|
||||
id: loader
|
||||
required property QsMenuEntry modelData
|
||||
|
||||
active: true
|
||||
|
||||
Component.onCompleted: {
|
||||
console.log(modelData.text);
|
||||
}
|
||||
|
||||
Layout.fillWidth: true
|
||||
Layout.minimumWidth: 160
|
||||
|
||||
sourceComponent: modelData.isSeparator ? menuSeperator : menuItem
|
||||
property Component menuSeperator: WrapperItem {
|
||||
margin: 4
|
||||
Rectangle {
|
||||
implicitHeight: 2
|
||||
|
||||
color: Styling.theme.base200
|
||||
}
|
||||
}
|
||||
property Component menuItem: StyledButton {
|
||||
text: loader.modelData.text
|
||||
|
||||
onClicked: loader.modelData.triggered()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue