From 34cc1ea4fa21ba6f59feee99fa72a0310544eb1d Mon Sep 17 00:00:00 2001 From: Daniel McInnes Date: Fri, 21 Jun 2024 16:00:31 +1000 Subject: [PATCH] Fix bug in AcWidget quantityLabel visibility --- components/ThreePhaseDisplay.qml | 1 - components/widgets/AcWidget.qml | 24 +++++++++++++++++++++--- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/components/ThreePhaseDisplay.qml b/components/ThreePhaseDisplay.qml index 8ff19044b..e4be89be1 100644 --- a/components/ThreePhaseDisplay.qml +++ b/components/ThreePhaseDisplay.qml @@ -75,7 +75,6 @@ Flow { : 0 dataObject: model font.pixelSize: phaseLabel.font.pixelSize - unitVisible: root.widgetSize >= VenusOS.OverviewWidget_Size_M valueColor: phaseDelegate.textColor unitColor: valueColor == Theme.color_font_primary ? Theme.color_font_secondary diff --git a/components/widgets/AcWidget.qml b/components/widgets/AcWidget.qml index 47aaca36b..8b6fbb69d 100644 --- a/components/widgets/AcWidget.qml +++ b/components/widgets/AcWidget.qml @@ -28,12 +28,30 @@ OverviewWidget { } active: root.phaseCount > 1 states: [ + State { + name: "extrasmall" + when: root.size === VenusOS.OverviewWidget_Size_XS + PropertyChanges { + target: root.quantityLabel + visible: !!quantityLabel.dataObject && extraContentLoader.status !== Loader.Ready // hide the total power, display the individual phase power + font.pixelSize: Theme.font_overviewPage_widget_quantityLabel_minimumSize + } + PropertyChanges { + target: root + secondaryTitle: extraContentLoader.status === Loader.Ready + ? "(%1)".arg(Units.defaultUnitString(Global.systemSettings.electricalQuantity)) // show either '(W)' or '(A)' + : "" + } + PropertyChanges { + target: extraContentLoader + anchors.bottomMargin: root.verticalMargin / 3 + } + }, State { name: "small" - when: root.size === VenusOS.OverviewWidget_Size_XS || root.size === VenusOS.OverviewWidget_Size_S + when: root.size === root.size === VenusOS.OverviewWidget_Size_S PropertyChanges { target: root.quantityLabel - visible: !!quantityLabel.dataObject && extraContentLoader.status !== Loader.Ready font.pixelSize: Theme.font_overviewPage_widget_quantityLabel_minimumSize } PropertyChanges { @@ -58,7 +76,7 @@ OverviewWidget { } }, State { - name: "medium-or-larger" + name: "large" when: root.size === VenusOS.OverviewWidget_Size_L || root.size === VenusOS.OverviewWidget_Size_XL PropertyChanges { target: root.quantityLabel