bar: fix vertical switching

IT WORKS AFHJIASHFGUOADGHOASF
Need to reload the preset when changing between but eh
This commit is contained in:
2 * r + 2 * t 2025-05-01 18:51:22 +10:00
parent f98036a303
commit bb09f65d50
2 changed files with 42 additions and 18 deletions

View file

@ -19,24 +19,29 @@ Variants {
anchors.top: true anchors.top: true
anchors.left: true anchors.left: true
// anchors.right: true
anchors.bottom: true
// Connections { Component.onCompleted: {
// target: BarConfig if (BarConfig.vertical)
win.anchors.bottom = true;
else
win.anchors.right = true;
}
// function onVerticalChanged(): void { Connections {
// win.visible = false; target: BarConfig
// if (BarConfig.vertical) {
// win.anchors.right = false; function onVerticalChanged(): void {
// win.anchors.bottom = true; win.visible = false;
// } else { if (BarConfig.vertical) {
// win.anchors.bottom = false; win.anchors.right = false;
// win.anchors.right = true; win.anchors.bottom = true;
// } } else {
// win.visible = true; win.anchors.bottom = false;
// } win.anchors.right = true;
// } }
win.visible = true;
}
}
Preset { Preset {
presetName: "pills" presetName: "pills"
@ -101,5 +106,16 @@ Variants {
} }
} }
] ]
Connections {
target: BarConfig
function onVerticalChanged(): void {
if (loader.state === "visible") {
loader.active = false;
loader.active = true;
}
}
}
} }
} }

View file

@ -5,10 +5,18 @@ Grid {
property bool vertical: parent.vertical ?? false // Propagate from parent property bool vertical: parent.vertical ?? false // Propagate from parent
flow: vertical ? Grid.TopToBottom : Grid.LeftToRight flow: vertical ? Grid.TopToBottom : Grid.LeftToRight
rows: vertical ? -1 : 1
columns: vertical ? 1 : -1
spacing: Appearance.spacing.small spacing: Appearance.spacing.small
onVerticalChanged: {
if (vertical) {
rows = -1;
columns = 1;
} else {
columns = -1;
rows = 1;
}
}
add: Transition { add: Transition {
NumberAnimation { NumberAnimation {
properties: "scale" properties: "scale"