migrate to widgets
This commit is contained in:
parent
3d34780820
commit
871e654af2
2 changed files with 10 additions and 14 deletions
|
|
@ -1,41 +1,36 @@
|
||||||
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
|
import qs.widgets
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Layouts
|
|
||||||
import Quickshell
|
import Quickshell
|
||||||
import Quickshell.Services.SystemTray
|
import Quickshell.Services.SystemTray
|
||||||
import Quickshell.Widgets
|
import Quickshell.Widgets
|
||||||
import "../../../../config/"
|
|
||||||
import "../../../../styled/"
|
|
||||||
import "menu/"
|
import "menu/"
|
||||||
|
|
||||||
Clickable {
|
StyledButton {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property SystemTrayItem trayItem
|
property SystemTrayItem trayItem
|
||||||
property bool menuOpened: false
|
property bool menuOpened: false
|
||||||
|
|
||||||
implicitWidth: Dimensions.tray.width
|
|
||||||
implicitHeight: Dimensions.tray.height
|
|
||||||
|
|
||||||
onClicked: toggleMenu()
|
onClicked: toggleMenu()
|
||||||
|
|
||||||
function toggleMenu() {
|
function toggleMenu() {
|
||||||
menuOpened = !menuOpened;
|
menuOpened = !menuOpened;
|
||||||
}
|
}
|
||||||
|
|
||||||
IconImage {
|
content: IconImage {
|
||||||
id: icon
|
id: icon
|
||||||
anchors.margins: 6
|
|
||||||
anchors.fill: parent
|
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
|
implicitSize: 18
|
||||||
source: {
|
source: {
|
||||||
let icon = modelData.icon;
|
let icon = root.trayItem.icon;
|
||||||
if (icon.includes("?path=")) {
|
if (icon.includes("?path=")) {
|
||||||
const [name, path] = icon.split("?path=");
|
const [name, path] = icon.split("?path=");
|
||||||
icon = `file://${path}/${name.slice(name.lastIndexOf("/") + 1)}`;
|
icon = `file://${path}/${name.slice(name.lastIndexOf("/") + 1)}`;
|
||||||
}
|
}
|
||||||
return icon;
|
return icon;
|
||||||
}
|
}
|
||||||
anchors.centerIn: parent
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Menu {
|
Menu {
|
||||||
|
|
@ -48,7 +43,7 @@ Clickable {
|
||||||
anchor.rect.y: root.height + 8
|
anchor.rect.y: root.height + 8
|
||||||
|
|
||||||
menuOpener: QsMenuOpener {
|
menuOpener: QsMenuOpener {
|
||||||
menu: trayItem.menu
|
menu: root.trayItem.menu
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ StyledPopupWindow {
|
||||||
Repeater {
|
Repeater {
|
||||||
model: window.menuOpener.children
|
model: window.menuOpener.children
|
||||||
delegate: Loader {
|
delegate: Loader {
|
||||||
|
id: loader
|
||||||
required property QsMenuEntry modelData
|
required property QsMenuEntry modelData
|
||||||
|
|
||||||
active: true
|
active: true
|
||||||
|
|
@ -34,7 +35,7 @@ StyledPopupWindow {
|
||||||
color: Theme.palette.base100
|
color: Theme.palette.base100
|
||||||
}
|
}
|
||||||
property Component menuItem: MenuItem {
|
property Component menuItem: MenuItem {
|
||||||
menuEntry: modelData
|
menuEntry: loader.modelData
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue