blob: 9e2e9f25663b60ac51b6e499d1bf4a138d53a762 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
import QtQuick
import QtQuick.Layouts
import Quickshell
Scope {
id: root
property var menuItem: null
property var parentWindow
property var anchorItem
property bool active: false
function open(item) {
anchorItem = item
active = true
menuAnchor.open()
}
function close() {
active = false
menuAnchor.close()
}
QsMenuAnchor {
id: menuAnchor
menu: root.menuItem
anchor.window: root.parentWindow
anchor.item: root.anchorItem
anchor.edges: Edges.Bottom
anchor.gravity: Edges.Bottom
anchor.margins.top: Theme.popupGap
onVisibleChanged: {
if (!visible && root.active) {
root.active = false
}
}
}
}
|