mirror of
https://github.com/tomasriveral/nixos.git
synced 2026-08-12 10:30:44 +02:00
ported some quickshell stuff from rivendell-hyprdots
This commit is contained in:
@@ -0,0 +1,73 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import Quickshell
|
||||
|
||||
ColumnLayout {
|
||||
id: root
|
||||
property alias menu: menuView.menu
|
||||
property Item animatingItem: null
|
||||
property bool animating: animatingItem != null
|
||||
|
||||
signal close
|
||||
signal submenuExpanded(item: var)
|
||||
|
||||
QsMenuOpener {
|
||||
id: menuView
|
||||
}
|
||||
|
||||
spacing: 0
|
||||
|
||||
Repeater {
|
||||
model: menuView.children
|
||||
|
||||
Loader {
|
||||
required property var modelData
|
||||
|
||||
property var item: Component {
|
||||
BoundComponent {
|
||||
id: itemComponent
|
||||
source: "MenuItem.qml"
|
||||
|
||||
property var entry: modelData
|
||||
|
||||
function onClose() {
|
||||
root.close();
|
||||
}
|
||||
|
||||
function onExpandedChanged() {
|
||||
if (item.expanded)
|
||||
root.submenuExpanded(item);
|
||||
}
|
||||
|
||||
function onAnimatingChanged() {
|
||||
if (item.animating) {
|
||||
root.animatingItem = this;
|
||||
} else if (root.animatingItem == this) {
|
||||
root.animatingItem = null;
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: root
|
||||
|
||||
function onSubmenuExpanded(expandedItem) {
|
||||
if (item != expandedItem)
|
||||
item.expanded = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
property var separator: Component {
|
||||
Rectangle {
|
||||
color: "#824524"
|
||||
implicitHeight: 4
|
||||
}
|
||||
}
|
||||
|
||||
sourceComponent: modelData.isSeparator ? separator : item
|
||||
Layout.fillHeight: true
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user