From ddbf7452c6f2fe8849de723175710dbf39242422 Mon Sep 17 00:00:00 2001 From: Nate Graham Date: Fri, 13 Jun 2025 11:55:47 -0600 Subject: [PATCH] applet: use standard section headers We have them; might as well use them. This lets us get rid of a bunch of complex and fragile code that's responsible for the existing separator. --- .../contents/ui/FullRepresentation.qml | 27 +++---------------- 1 file changed, 3 insertions(+), 24 deletions(-) diff --git a/src/applet/package/contents/ui/FullRepresentation.qml b/src/applet/package/contents/ui/FullRepresentation.qml index df989267d..27295de21 100644 --- a/src/applet/package/contents/ui/FullRepresentation.qml +++ b/src/applet/package/contents/ui/FullRepresentation.qml @@ -111,31 +111,10 @@ PlasmaExtras.Representation { bottomMargin: Kirigami.Units.largeSpacing section.property: "Section" - // We want to hide the section delegate for the "Connected" - // group because it's unnecessary; all we want to do here is - // separate the connected devices from the available ones - section.delegate: Loader { + section.delegate: PlasmaExtras.ListSectionHeader { required property string section - - active: section !== "Connected" && BluezQt.Manager.connectedDevices.length > 0 - - width: ListView.view.width - ListView.view.leftMargin - ListView.view.rightMargin - // Need to manually set the height or else the loader takes up - // space after the first time it unloads a previously-loaded item - height: active ? Kirigami.Units.gridUnit : 0 - - // give us 2 frames to try and figure out a layout, this reduces jumpyness quite a bit but doesn't - // entirely eliminate it https://bugs.kde.org/show_bug.cgi?id=438610 - Behavior on height { PropertyAnimation { duration: 32 } } - - sourceComponent: Item { - KSvg.SvgItem { - width: parent.width - Kirigami.Units.gridUnit * 2 - anchors.centerIn: parent - imagePath: "widgets/line" - elementId: "horizontal-line" - } - } + width: listView.width - listView.leftMargin - listView.rightMargin + text: section } highlight: PlasmaExtras.Highlight {} highlightMoveDuration: Kirigami.Units.shortDuration -- GitLab