From e2daa091e81361d688db93bde46faf702f30bc75 Mon Sep 17 00:00:00 2001 From: James Graham Date: Fri, 20 Jun 2025 07:42:14 +0100 Subject: [PATCH] Switch section delegate for standard Kirigami.ListSectionHeader Switch section delegate for standard Kirigami.ListSectionHeader, SectionDelegate is no longer required so removed. --- src/timeline/CMakeLists.txt | 1 - src/timeline/MessageDelegate.qml | 7 ++-- src/timeline/SectionDelegate.qml | 55 -------------------------------- src/timeline/StateDelegate.qml | 6 ++-- 4 files changed, 6 insertions(+), 63 deletions(-) delete mode 100644 src/timeline/SectionDelegate.qml diff --git a/src/timeline/CMakeLists.txt b/src/timeline/CMakeLists.txt index db44b18c5..e602cebc2 100644 --- a/src/timeline/CMakeLists.txt +++ b/src/timeline/CMakeLists.txt @@ -19,7 +19,6 @@ ecm_add_qml_module(Timeline GENERATE_PLUGIN_SOURCE TimelineEndDelegate.qml Bubble.qml AvatarFlow.qml - SectionDelegate.qml QuickActions.qml TypingPane.qml BaseMessageComponentChooser.qml diff --git a/src/timeline/MessageDelegate.qml b/src/timeline/MessageDelegate.qml index 24cced098..49260c6dc 100644 --- a/src/timeline/MessageDelegate.qml +++ b/src/timeline/MessageDelegate.qml @@ -201,10 +201,9 @@ MessageDelegateBase { } } - sectionComponent: SectionDelegate { - id: sectionDelegate - labelText: root.section - colorSet: root.compactMode ? Kirigami.Theme.View : Kirigami.Theme.Window + sectionComponent: Kirigami.ListSectionHeader { + horizontalPadding: 0 + text: root.section } readMarkerComponent: AvatarFlow { diff --git a/src/timeline/SectionDelegate.qml b/src/timeline/SectionDelegate.qml deleted file mode 100644 index 81a75000a..000000000 --- a/src/timeline/SectionDelegate.qml +++ /dev/null @@ -1,55 +0,0 @@ -// SPDX-FileCopyrightText: 2019 Black Hat -// SPDX-FileCopyrightText: 2020 Carl Schwan -// SPDX-License-Identifier: GPL-3.0-only - -import QtQuick -import QtQuick.Controls as QQC2 -import QtQuick.Layouts - -import org.kde.kirigami as Kirigami - -import org.kde.neochat - -QQC2.ItemDelegate { - id: root - - property alias labelText: sectionLabel.text - property var maxWidth: Number.POSITIVE_INFINITY - - property int colorSet: Kirigami.Theme.Window - - leftPadding: 0 - rightPadding: 0 - topPadding: Kirigami.Units.largeSpacing - bottomPadding: 0 // Note not 0 by default - - leftInset: 0 - rightInset: 0 - topInset: -1 // This -1 is intentional to stretch the background one more pixel to prevent a visual bug when scrolling - bottomInset: 0 - - contentItem: ColumnLayout { - spacing: Kirigami.Units.smallSpacing - Layout.fillWidth: true - - Kirigami.Heading { - id: sectionLabel - level: 4 - color: Kirigami.Theme.disabledTextColor - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - Layout.fillWidth: true - Layout.maximumWidth: maxWidth - } - Kirigami.Separator { - Layout.fillWidth: true - Layout.maximumWidth: maxWidth - } - } - - background: Rectangle { - color: NeoChatConfig.blur ? "transparent" : Kirigami.Theme.backgroundColor - Kirigami.Theme.inherit: false - Kirigami.Theme.colorSet: root.colorSet - } -} diff --git a/src/timeline/StateDelegate.qml b/src/timeline/StateDelegate.qml index aa18f0bfb..491683ce5 100644 --- a/src/timeline/StateDelegate.qml +++ b/src/timeline/StateDelegate.qml @@ -69,11 +69,11 @@ TimelineDelegate { alwaysFillWidth: NeoChatConfig.compactLayout contentItem: ColumnLayout { - SectionDelegate { + Kirigami.ListSectionHeader { Layout.fillWidth: true visible: root.showSection - labelText: root.section - colorSet: NeoChatConfig.compactLayout ? Kirigami.Theme.View : Kirigami.Theme.Window + horizontalPadding: 0 + text: root.section } RowLayout { Layout.fillWidth: true