BarContent: better margins-anchoring management

This commit is contained in:
ItsLemmy
2025-11-09 18:39:15 -05:00
parent ef4c773d13
commit 6f215b4265
3 changed files with 28 additions and 5 deletions
+2 -2
View File
@@ -27,8 +27,8 @@ Item {
readonly property string barPosition: Settings.data.bar.position || "top"
readonly property bool barIsVertical: barPosition === "left" || barPosition === "right"
readonly property bool barFloating: Settings.data.bar.floating || false
readonly property real barMarginH: barFloating ? Settings.data.bar.marginHorizontal * Style.marginXL : 0
readonly property real barMarginV: barFloating ? Settings.data.bar.marginVertical * Style.marginXL : 0
readonly property real barMarginH: 0 //barFloating ? Settings.data.bar.marginHorizontal * Style.marginXL : 0
readonly property real barMarginV: 0 //barFloating ? Settings.data.bar.marginVertical * Style.marginXL : 0
// Fill the parent (the Loader)
anchors.fill: parent
+12 -3
View File
@@ -44,9 +44,18 @@ PanelWindow {
left: barPosition === "left" || !barIsVertical
right: barPosition === "right" || !barIsVertical
}
// Set to FULL screen dimensions - margins will reduce the actual window size
implicitWidth: (barIsVertical ? (Style.barHeight + 1) : barWindow.screen.width) + barMarginH
implicitHeight: (barIsVertical ? barWindow.screen.height : Style.barHeight) + barMarginV
// Handle floating margins
margins {
top: barPosition === "top" || barIsVertical ? barMarginV : 0
bottom: barPosition === "bottom" || barIsVertical ? barMarginV : 0
left: barPosition === "left" || !barIsVertical ? barMarginH : 0
right: barPosition === "right" || !barIsVertical ? barMarginH : 0
}
// Set a tight window size
implicitWidth: barIsVertical ? Style.barHeight : barWindow.screen.width
implicitHeight: barIsVertical ? barWindow.screen.height : Style.barHeight
// Bar content - just the widgets, no background
Bar {
+14
View File
@@ -17,6 +17,8 @@ SmartPanel {
readonly property bool attachToBar: Settings.data.ui.settingsPanelAttachToBar
readonly property string barPosition: Settings.data.bar.position
readonly property bool barFloating: Settings.data.bar.floating
readonly property real barMarginH: barFloating ? Settings.data.bar.marginHorizontal * Style.marginXL : 0
readonly property real barMarginV: barFloating ? Settings.data.bar.marginVertical * Style.marginXL : 0
forceAttachToBar: attachToBar
panelAnchorHorizontalCenter: attachToBar ? (barPosition === "top" || barPosition === "bottom") : true
@@ -44,6 +46,18 @@ SmartPanel {
}
}
onBarMarginHChanged: {
if (isPanelOpen) {
Qt.callLater(root.setPosition)
}
}
onBarMarginVChanged: {
if (isPanelOpen) {
Qt.callLater(root.setPosition)
}
}
// Tabs enumeration, order is NOT relevant
enum Tab {
About,