Fix spacing for vertical bar
This commit is contained in:
parent
e706dabef3
commit
ee50d84a53
5 changed files with 28 additions and 36 deletions
|
|
@ -171,14 +171,13 @@ Variants {
|
|||
|
||||
Component {
|
||||
id: horizontalBarComponent
|
||||
Row {
|
||||
Item {
|
||||
anchors.fill: parent
|
||||
|
||||
// Left Section
|
||||
Row {
|
||||
RowLayout {
|
||||
id: leftSection
|
||||
objectName: "leftSection"
|
||||
height: parent.height
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: Style.marginS * root.scaling
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
|
@ -197,16 +196,14 @@ Variants {
|
|||
"sectionWidgetsCount": Settings.data.bar.widgets.left.length,
|
||||
"barPosition": BarService.position
|
||||
}
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Center Section
|
||||
Row {
|
||||
RowLayout {
|
||||
id: centerSection
|
||||
objectName: "centerSection"
|
||||
height: parent.height
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
spacing: Style.marginS * root.scaling
|
||||
|
|
@ -224,16 +221,14 @@ Variants {
|
|||
"sectionWidgetsCount": Settings.data.bar.widgets.center.length,
|
||||
"barPosition": BarService.position
|
||||
}
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Right Section
|
||||
Row {
|
||||
RowLayout {
|
||||
id: rightSection
|
||||
objectName: "rightSection"
|
||||
height: parent.height
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: Style.marginS * root.scaling
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
|
@ -252,7 +247,6 @@ Variants {
|
|||
"sectionWidgetsCount": Settings.data.bar.widgets.right.length,
|
||||
"barPosition": BarService.position
|
||||
}
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,17 +19,17 @@ 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.baseWidgetSize * 0.8 * scaling) : calculatedHorizontalWidth()
|
||||
implicitWidth = Qt.binding(function () {
|
||||
return (barPosition === "left" || barPosition === "right") ? Math.round(Style.baseWidgetSize * 0.8 * scaling) : (horizontalLayout.implicitWidth + Style.marginM * 2 * scaling)
|
||||
})
|
||||
implicitHeight = Qt.binding(function() {
|
||||
implicitHeight = Qt.binding(function () {
|
||||
return (barPosition === "left" || barPosition === "right") ? calculatedVerticalHeight() : Math.round(Style.barHeight * scaling)
|
||||
})
|
||||
}
|
||||
|
|
@ -53,7 +53,7 @@ Item {
|
|||
readonly property real maxWidth: minWidth * 2
|
||||
|
||||
implicitHeight: (barPosition === "left" || barPosition === "right") ? calculatedVerticalHeight() : Math.round(Style.barHeight * scaling)
|
||||
implicitWidth: (barPosition === "left" || barPosition === "right") ? Math.round(Style.baseWidgetSize * 0.8 * scaling) : calculatedHorizontalWidth()
|
||||
implicitWidth: (barPosition === "left" || barPosition === "right") ? Math.round(Style.baseWidgetSize * 0.8 * scaling) : (horizontalLayout.implicitWidth + Style.marginM * 2 * scaling)
|
||||
|
||||
function getTitle() {
|
||||
try {
|
||||
|
|
@ -97,8 +97,7 @@ Item {
|
|||
total += titleWidth
|
||||
}
|
||||
|
||||
// Row layout handles spacing between widgets
|
||||
|
||||
// Row layout handles spacing between widgets
|
||||
return Math.max(total, Style.capsuleHeight * scaling) // Minimum width
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,17 +19,17 @@ 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.baseWidgetSize * 0.8 * scaling) : calculatedHorizontalWidth()
|
||||
implicitWidth = Qt.binding(function () {
|
||||
return (barPosition === "left" || barPosition === "right") ? Math.round(Style.baseWidgetSize * 0.8 * scaling) : (rowLayout.implicitWidth + Style.marginM * 2 * scaling)
|
||||
})
|
||||
implicitHeight = Qt.binding(function() {
|
||||
implicitHeight = Qt.binding(function () {
|
||||
return (barPosition === "left" || barPosition === "right") ? calculatedVerticalHeight() : Math.round(Style.barHeight * scaling)
|
||||
})
|
||||
}
|
||||
|
|
@ -75,7 +75,7 @@ Item {
|
|||
}
|
||||
|
||||
implicitHeight: (barPosition === "left" || barPosition === "right") ? calculatedVerticalHeight() : Math.round(Style.barHeight * scaling)
|
||||
implicitWidth: (barPosition === "left" || barPosition === "right") ? Math.round(Style.baseWidgetSize * 0.8 * scaling) : calculatedHorizontalWidth()
|
||||
implicitWidth: (barPosition === "left" || barPosition === "right") ? Math.round(Style.baseWidgetSize * 0.8 * scaling) : (rowLayout.implicitWidth + Style.marginM * 2 * scaling)
|
||||
|
||||
visible: MediaService.currentPlayer !== null && MediaService.canPlay
|
||||
|
||||
|
|
|
|||
|
|
@ -17,17 +17,17 @@ 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.capsuleHeight * scaling) : calculatedHorizontalWidth()
|
||||
implicitWidth = Qt.binding(function () {
|
||||
return (barPosition === "left" || barPosition === "right") ? Math.round(Style.capsuleHeight * scaling) : (horizontalLayout.implicitWidth + Style.marginL * 2 * scaling)
|
||||
})
|
||||
implicitHeight = Qt.binding(function() {
|
||||
implicitHeight = Qt.binding(function () {
|
||||
return (barPosition === "left" || barPosition === "right") ? calculatedVerticalHeight() : Math.round(Style.barHeight * scaling)
|
||||
})
|
||||
}
|
||||
|
|
@ -52,7 +52,7 @@ Item {
|
|||
readonly property bool showDiskUsage: (widgetSettings.showDiskUsage !== undefined) ? widgetSettings.showDiskUsage : widgetMetadata.showDiskUsage
|
||||
|
||||
implicitHeight: (barPosition === "left" || barPosition === "right") ? calculatedVerticalHeight() : Math.round(Style.barHeight * scaling)
|
||||
implicitWidth: (barPosition === "left" || barPosition === "right") ? Math.round(Style.capsuleHeight * scaling) : calculatedHorizontalWidth()
|
||||
implicitWidth: (barPosition === "left" || barPosition === "right") ? Math.round(Style.capsuleHeight * scaling) : (horizontalLayout.implicitWidth + Style.marginL * 2 * scaling)
|
||||
|
||||
function calculatedVerticalHeight() {
|
||||
let total = 0
|
||||
|
|
@ -70,14 +70,14 @@ Item {
|
|||
visibleCount++
|
||||
|
||||
total = visibleCount * Math.round(Style.capsuleHeight * scaling)
|
||||
total += Math.max(visibleCount - 1, 0) * Style.marginS * scaling
|
||||
total += Math.max(visibleCount - 1, 0) * Style.marginXS * scaling
|
||||
total += Style.marginM * scaling * 2 // padding
|
||||
|
||||
return total
|
||||
}
|
||||
|
||||
function calculatedHorizontalWidth() {
|
||||
let total = Style.marginM * scaling * 2 // base padding
|
||||
let total = Style.marginL * scaling * 2.5 // base padding
|
||||
|
||||
if (showCpuUsage) {
|
||||
// Icon + "99%" text
|
||||
|
|
@ -136,8 +136,7 @@ Item {
|
|||
total += (visibleCount - 1) * Style.marginXS * scaling
|
||||
}
|
||||
|
||||
// Row layout handles spacing between widgets
|
||||
|
||||
// Row layout handles spacing between widgets
|
||||
return Math.max(total, Style.capsuleHeight * scaling)
|
||||
}
|
||||
|
||||
|
|
@ -145,7 +144,7 @@ Item {
|
|||
id: backgroundContainer
|
||||
anchors.left: parent.left
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
width: (barPosition === "left" || barPosition === "right") ? Math.round(Style.capsuleHeight * scaling) : calculatedHorizontalWidth()
|
||||
width: (barPosition === "left" || barPosition === "right") ? Math.round(Style.capsuleHeight * scaling) : (horizontalLayout.implicitWidth + Style.marginL * 2 * scaling)
|
||||
height: (barPosition === "left" || barPosition === "right") ? parent.height : Math.round(Style.capsuleHeight * scaling)
|
||||
radius: Math.round(Style.radiusM * scaling)
|
||||
color: Color.mSurfaceVariant
|
||||
|
|
@ -345,7 +344,7 @@ Item {
|
|||
anchors.centerIn: parent
|
||||
width: Math.round(32 * scaling)
|
||||
height: parent.height - Style.marginM * scaling * 2
|
||||
spacing: Style.marginS * scaling
|
||||
spacing: Style.marginXS * scaling
|
||||
visible: barPosition === "left" || barPosition === "right"
|
||||
|
||||
// CPU Usage Component
|
||||
|
|
|
|||
|
|
@ -20,17 +20,17 @@ 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() {
|
||||
implicitWidth = Qt.binding(function () {
|
||||
return (barPosition === "left" || barPosition === "right") ? Math.round(Style.barHeight * scaling) : calculatedHorizontalWidth()
|
||||
})
|
||||
implicitHeight = Qt.binding(function() {
|
||||
implicitHeight = Qt.binding(function () {
|
||||
return (barPosition === "left" || barPosition === "right") ? calculatedVerticalHeight() : Math.round(Style.barHeight * scaling)
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue