mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
BarContent: better margins-anchoring management
This commit is contained in:
+2
-2
@@ -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
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user