Add BarService, use signals to check state of bar and update widgets accordingly

This commit is contained in:
Ly-sec 2025-09-13 15:31:23 +02:00
parent dcedae46e5
commit e706dabef3
7 changed files with 115 additions and 28 deletions

View file

@ -20,6 +20,21 @@ Item {
property int sectionWidgetIndex: -1
property int sectionWidgetsCount: 0
property string barPosition: "top"
// Listen to BarService position changes
Connections {
target: BarService
function onBarPositionChanged(newPosition) {
barPosition = newPosition
// Force re-evaluation of implicit sizing
implicitWidth = Qt.binding(function() {
return (barPosition === "left" || barPosition === "right") ? Math.round(Style.barHeight * scaling) : calculatedHorizontalWidth()
})
implicitHeight = Qt.binding(function() {
return (barPosition === "left" || barPosition === "right") ? calculatedVerticalHeight() : Math.round(Style.barHeight * scaling)
})
}
}
property var widgetMetadata: BarWidgetRegistry.widgetMetadata[widgetId]
property var widgetSettings: {