MauiKit Controls

SectionGroup.qml
1import QtQuick
2
3import QtQuick.Layouts
4import QtQuick.Controls
5
6import org.mauikit.controls 1.3 as Maui
7
8/**
9 * @inherit QtQuick.Controls.Pane
10 * @since org.mauikit.controls
11 * @brief A control to group children elements into a column layout with a header section with a title and message body.
12 *
13 * <a href="https://doc.qt.io/qt-6/qml-qtquick-controls-pane.html">This controls inherits from QQC2 Pane, to checkout its inherited properties refer to the Qt Docs.</a>
14 *
15 * @image html Misc/sectiongroup.png "Example of different usages of the control"
16 *
17 * @code
18 * Maui.SectionGroup
19 * {
20 * title: "Section with Children"
21 * description: "The description label can be a bit longer explaining something importand. Maybe?"
22 *
23 * Rectangle
24 * {
25 * Layout.fillWidth: true
26 * implicitHeight: 60
27 * radius: 20
28 *
29 * color: "orange"
30 * }
31 * }
32 * @endcode
33 *
34 * @note Consider using the SectionItem or FlexSectionItem as the children elements of this control, in order to have a more cohesive look with another MauiKit applications.
35 *
36 * <a href="https://invent.kde.org/maui/mauikit/-/blob/qt6-2/examples/SectionGroup.qml">You can find a more complete example at this link.</a>
37 */
38Pane
39{
40 id: control
41
42 /**
43 * @brief By default the content children will be placed on a ColumnLayout, so use the Layout attached properties for positioning them.
44 * @note The children elements should have an implicit height.
45 * @property list<QtObject>
46 */
47 default property alias content : _layout.data
49 /**
50 * @brief The title of the section header.
51 * @property string SectionGroup::title
52 */
53 property alias title : _template.text1
54
55 /**
56 * @brief The message body of the section header.
57 * @property string SectionGroup::description
58 */
59 property alias description : _template.text2
60
61 /**
62 * @brief An alias to the section header title control, which is handled by SectionHeader
63 * More properties can be accessed via this alias, such as setting a custom icon or image, etc, for that use the `template` of the `template`.
64 * @code
65 * Maui.SectionGroup
66 * {
67 * title: "Hello"
68 * description: "Description text"
69 * template.template.iconSource: "folder" //Here we access the template of this control, which is a SectionHeader, and then the template fo the section header, which is a ListItemTemplate.
70 * }
71 * @endcode
72 * @see SectionHeader
73 * @see ListItemTemplate
74 * @property SectionHeader SectionGroup::template
75 */
76 readonly property alias template: _template
77
78 spacing: Maui.Style.defaultSpacing
79
80 Layout.fillWidth: true
81 padding: Maui.Style.contentMargins
82
83 implicitHeight: implicitContentHeight + topPadding + bottomPadding
84
85 background: null
86
87 contentItem: ColumnLayout
88 {
89 id: _layout
90 spacing: control.spacing
91
92 Maui.SectionHeader
93 {
94 id: _template
95 Layout.fillWidth: true
96 label1.font: Maui.Style.defaultFont
97 label1.text: control.title
98 label2.text: control.description
99 label1.opacity: 0.7
100 label2.opacity: 0.7
101 template.iconSizeHint: Maui.Style.iconSizes.medium
102 }
103 }
104}
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri May 17 2024 11:56:16 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.