Kirigami2

ListSectionHeader.qml
1/*
2 * SPDX-FileCopyrightText: 2019 Björn Feber <bfeber@protonmail.com>
3 *
4 * SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6
7import QtQuick
8import QtQuick.Controls as QQC2
9import QtQuick.Layouts
10import org.kde.kirigami as Kirigami
11
12/**
13 * @brief A section delegate for the primitive ListView component.
14 *
15 * It's intended to make all listviews look coherent.
16 *
17 * Any additional content items will be positioned in a row at the trailing side
18 * of this component.
19 *
20 * Example usage:
21 * @code
22 * import QtQuick
23 * import QtQuick.Controls as QQC2
24 * import org.kde.kirigami as Kirigami
25 *
26 * ListView {
27 * section.delegate: Kirigami.ListSectionHeader {
28 * text: section
29 *
30 * QQC2.Button {
31 * text: "Button 1"
32 * }
33 * QQC2.Button {
34 * text: "Button 2"
35 * }
36 * }
37 * }
38 * @endcode
39 */
40QQC2.ItemDelegate {
41 id: listSection
42
43 /**
44 * @brief This property sets the text of the ListView's section header.
45 * @property string label
46 * @deprecated since 6.2 Use base type's AbstractButton::text property directly
47 */
48 @Deprecated { reason: "Use base type's AbstractButton::text property directly" }
49 property alias label: listSection.text
50
51 default property alias _contents: rowLayout.data
52
53 hoverEnabled: false
54
55 activeFocusOnTab: false
56
57 // we do not need a background
58 background: Item {}
59
60 topPadding: Kirigami.Units.largeSpacing + Kirigami.Units.smallSpacing
61
62 contentItem: RowLayout {
63 id: rowLayout
64 spacing: Kirigami.Units.largeSpacing
65
66 Kirigami.Heading {
67 Layout.maximumWidth: rowLayout.width
68 Layout.alignment: Qt.AlignVCenter
69
70 opacity: 0.7
71 level: 5
72 type: Kirigami.Heading.Primary
73 text: listSection.text
74 elide: Text.ElideRight
75
76 // we override the Primary type's font weight (DemiBold) for Bold for contrast with small text
77 font.weight: Font.Bold
78
79 Accessible.ignored: true
80 }
81
82 Kirigami.Separator {
83 Layout.fillWidth: true
84 Layout.alignment: Qt.AlignVCenter
85 Accessible.ignored: true
86 }
87 }
88}
Type type(const QSqlDatabase &db)
QStringView level(QStringView ifopt)
QChar * data()
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:56:52 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.