popouts: reload tray menu on show
This commit is contained in:
parent
d76587c2db
commit
82756b2866
3 changed files with 35 additions and 17 deletions
|
|
@ -15,16 +15,6 @@ Item {
|
||||||
property real currentCenter
|
property real currentCenter
|
||||||
property bool hasCurrent
|
property bool hasCurrent
|
||||||
|
|
||||||
Behavior on currentCenter {
|
|
||||||
enabled: root.implicitWidth > 0
|
|
||||||
|
|
||||||
NumberAnimation {
|
|
||||||
duration: Appearance.anim.durations.normal
|
|
||||||
easing.type: Easing.BezierSpline
|
|
||||||
easing.bezierCurve: Appearance.anim.curves.emphasized
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
|
|
||||||
implicitWidth: hasCurrent ? (content.children.find(c => c.shouldBeActive)?.implicitWidth ?? 0) + Appearance.padding.large * 2 : 0
|
implicitWidth: hasCurrent ? (content.children.find(c => c.shouldBeActive)?.implicitWidth ?? 0) + Appearance.padding.large * 2 : 0
|
||||||
|
|
@ -70,8 +60,26 @@ Item {
|
||||||
required property int index
|
required property int index
|
||||||
|
|
||||||
name: `traymenu${index}`
|
name: `traymenu${index}`
|
||||||
sourceComponent: TrayMenu {
|
sourceComponent: trayMenuComp
|
||||||
trayItem: trayMenu.modelData.menu
|
|
||||||
|
Connections {
|
||||||
|
target: root
|
||||||
|
|
||||||
|
function onHasCurrentChanged(): void {
|
||||||
|
if (root.hasCurrent && trayMenu.shouldBeActive) {
|
||||||
|
trayMenu.sourceComponent = null;
|
||||||
|
trayMenu.sourceComponent = trayMenuComp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Component {
|
||||||
|
id: trayMenuComp
|
||||||
|
|
||||||
|
TrayMenu {
|
||||||
|
popouts: root
|
||||||
|
trayItem: trayMenu.modelData.menu
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -91,6 +99,16 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Behavior on currentCenter {
|
||||||
|
enabled: root.implicitWidth > 0
|
||||||
|
|
||||||
|
NumberAnimation {
|
||||||
|
duration: Appearance.anim.durations.normal
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.emphasized
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
component Popout: Loader {
|
component Popout: Loader {
|
||||||
id: popout
|
id: popout
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ import QtQuick.Controls
|
||||||
StackView {
|
StackView {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
|
required property Item popouts
|
||||||
required property QsMenuHandle trayItem
|
required property QsMenuHandle trayItem
|
||||||
|
|
||||||
implicitWidth: currentItem.implicitWidth
|
implicitWidth: currentItem.implicitWidth
|
||||||
|
|
@ -27,9 +28,7 @@ StackView {
|
||||||
|
|
||||||
component Anim: Transition {
|
component Anim: Transition {
|
||||||
NumberAnimation {
|
NumberAnimation {
|
||||||
duration: 0 // Appearance.anim.durations.normal
|
duration: 0
|
||||||
easing.type: Easing.BezierSpline
|
|
||||||
easing.bezierCurve: Appearance.anim.curves.standard
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -114,8 +113,10 @@ StackView {
|
||||||
handle: entry,
|
handle: entry,
|
||||||
isSubMenu: true
|
isSubMenu: true
|
||||||
}));
|
}));
|
||||||
else
|
else {
|
||||||
item.modelData.triggered();
|
item.modelData.triggered();
|
||||||
|
root.popouts.hasCurrent = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
import "root:/services"
|
import "root:/services"
|
||||||
import Quickshell.Io
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
|
|
||||||
Image {
|
Image {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue