From 6188faad828bdfabc4932098a3b07ea708fff538 Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Sat, 4 Oct 2025 19:56:22 +0800 Subject: style: columnLayout --- bar/Network.qml | 38 +++++++++++++++++++++++++++++++------- bar/components/SimpleResource.qml | 29 ++++++++++++++++++++--------- components/IText.qml | 3 ++- config/General.qml | 2 +- 4 files changed, 54 insertions(+), 18 deletions(-) diff --git a/bar/Network.qml b/bar/Network.qml index 7774035..a343977 100644 --- a/bar/Network.qml +++ b/bar/Network.qml @@ -55,31 +55,55 @@ Item { renderType: Text.CurveRendering // it's not static and is rapidly updated } - RowLayout { - spacing: Bar.resourceIconTextSpacing / 2 - Icon { - text: Icons.resource.network.download - color: root.downUnit == root.usageUnit && root.down > root.significantUsage ? Colors.cyan : Colors.foreground2 + ColumnLayout { + // spacing: Bar.resourceIconTextSpacing / 2 + spacing: 0 + Item { + Layout.fillHeight: true + Layout.fillWidth: true } IText { animate: true + Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter text: root.down + root.downUnit color: root.downUnit == root.usageUnit && root.down > root.significantUsage ? Colors.cyan : Colors.foreground2 renderType: Text.CurveRendering // it's not static and is rapidly updated } + Icon { + Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter + text: Icons.resource.network.download + iconSize: Style.font.size.normal + color: root.downUnit == root.usageUnit && root.down > root.significantUsage ? Colors.cyan : Colors.foreground2 + } + Item { + Layout.fillHeight: true + Layout.fillWidth: true + } } - RowLayout { - spacing: Bar.resourceIconTextSpacing / 2 + ColumnLayout { + // spacing: Bar.resourceIconTextSpacing / 2 + spacing: 0 + Item { + Layout.fillHeight: true + Layout.fillWidth: true + } Icon { + Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter text: Icons.resource.network.upload + iconSize: Style.font.size.normal color: root.upUnit == root.usageUnit && root.up > root.significantUsage ? Colors.cyan : Colors.foreground2 } IText { animate: true + Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter text: root.up + root.upUnit color: root.upUnit == root.usageUnit && root.up > root.significantUsage ? Colors.cyan : Colors.foreground2 renderType: Text.CurveRendering // it's not static and is rapidly updated } + Item { + Layout.fillHeight: true + Layout.fillWidth: true + } } Item { diff --git a/bar/components/SimpleResource.qml b/bar/components/SimpleResource.qml index 818327d..793e5e1 100644 --- a/bar/components/SimpleResource.qml +++ b/bar/components/SimpleResource.qml @@ -38,15 +38,26 @@ Item { Layout.fillWidth: true } - Icon { - text: !root.isAlt ? root.icon : root.altIcon - color: root.value < root.thresholdL1 ? Colors.foreground2 : root.value >= root.thresholdL3 ? root.thresholdColorL3 : root.value >= root.thresholdL2 ? root.thresholdColorL2 : root.thresholdColorL1 - } - IText { - animate: true - renderType: Text.CurveRendering // it's not static and is rapidly updated - text: !root.isAlt ? root.text : root.altText - color: root.value < root.thresholdL1 ? Colors.foreground1 : root.value >= root.thresholdL3 ? root.thresholdColorL3 : root.value >= root.thresholdL2 ? root.thresholdColorL2 : root.thresholdColorL1 + ColumnLayout { + spacing: 0 + Item { + Layout.fillHeight: true + Layout.fillWidth: true + } + IText { + animate: true + renderType: Text.CurveRendering // it's not static and is rapidly updated + text: !root.isAlt ? root.text : root.altText + fontSize: Style.font.size.largerr + color: root.value < root.thresholdL1 ? Colors.foreground1 : root.value >= root.thresholdL3 ? root.thresholdColorL3 : root.value >= root.thresholdL2 ? root.thresholdColorL2 : root.thresholdColorL1 + } + + Icon { + Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter + iconSize: Style.font.size.small + text: !root.isAlt ? root.icon : root.altIcon + color: root.value < root.thresholdL1 ? Colors.foreground2 : root.value >= root.thresholdL3 ? root.thresholdColorL3 : root.value >= root.thresholdL2 ? root.thresholdColorL2 : root.thresholdColorL1 + } } Item { diff --git a/components/IText.qml b/components/IText.qml index 416fd40..d926e02 100644 --- a/components/IText.qml +++ b/components/IText.qml @@ -10,6 +10,7 @@ Text { property bool animate: false property real animateFrom: 0 property real animateTo: 1 + property real fontSize: Style.font.size.larger renderType: Text.NativeRendering // or Text.CurveRendering(much more expansive) or Text.QtRendering for faster textFormat: Text.PlainText @@ -20,7 +21,7 @@ Text { font { family: Style.font.family.iosevka // pointSize: root.pixelSize - pixelSize: Style.font.size.larger + pixelSize: fontSize } Behavior on color { diff --git a/config/General.qml b/config/General.qml index 75f0e5b..c25c66e 100644 --- a/config/General.qml +++ b/config/General.qml @@ -7,7 +7,7 @@ Singleton { readonly property int resourceUpdateInterval: 1 - readonly property real iconSize: Style.font.size.larger ?? 16 + readonly property real iconSize: Style.font.size.larger readonly property string cpuThermalPath: "/sys/class/thermal/thermal_zone0/temp" -- cgit v1.2.3