From 9f46f8bed89bb63ddb6014493ff2999f266887a6 Mon Sep 17 00:00:00 2001 From: loner <2788892716@qq.com> Date: Fri, 17 Oct 2025 06:30:55 +0800 Subject: [PATCH] refactor(bar): Use ternary operator for scaling property --- Modules/Bar/Extras/BarWidgetLoader.qml | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/Modules/Bar/Extras/BarWidgetLoader.qml b/Modules/Bar/Extras/BarWidgetLoader.qml index 40610d3a..1f3b10a3 100644 --- a/Modules/Bar/Extras/BarWidgetLoader.qml +++ b/Modules/Bar/Extras/BarWidgetLoader.qml @@ -13,17 +13,7 @@ Item { property int sectionIndex: widgetProps && widgetProps.sectionWidgetIndex || 0 property string barDensity: "default" - readonly property real scaling: (function() { - switch (barDensity) { - case "mini": - return 0.8 - case "compact": - return 0.9 - case "comfortable": - default: - return 1.0 - } - })() + readonly property real scaling: barDensity === "mini" ? 0.8 : (barDensity === "compact" ? 0.9 : 1.0) // Don't reserve space unless the loaded widget is really visible implicitWidth: getImplicitSize(loader.item, "implicitWidth")