9import QtQuick.Controls as QQC2
10import org.kde.kirigami as Kirigami
38 readonly property int margins: 6
46 property bool framedView: true
53 property bool extraFooterTopPadding: false
62 property bool headerPaddingEnabled: true
71 property bool footerPaddingEnabled: true
73 property bool sidebarMode: false
75 function __itemVisible(item: Item): bool {
76 return item !== null && item.visible && item.implicitHeight > 0;
79 function __headerContentVisible(): bool {
80 return __itemVisible(headerParent.contentItem);
82 function __footerContentVisible(): bool {
83 return __itemVisible(footerParent.contentItem);
90 function __headerSeparatorVisible(): bool {
91 return !framedView && __headerContentVisible();
93 function __footerSeparatorVisible(): bool {
94 return !framedView && extraFooterTopPadding;
97 title: (typeof kcm !==
"undefined") ? kcm.name :
""
107 topPadding: framedView && !__headerContentVisible() ? margins : 0
108 leftPadding: undefined
109 rightPadding: undefined
110 bottomPadding: framedView && !__footerContentVisible() ? margins : 0
111 verticalPadding: undefined
112 horizontalPadding: framedView ? margins : 0
123 height: root.__headerContentVisible() ? undefined : 0
124 padding: root.headerPaddingEnabled ? root.margins : 0
135 visible: root.__headerSeparatorVisible()
142 visible: !root.framedView
145 color:
Kirigami.Theme.backgroundColor
157 visible: root.__footerSeparatorVisible()
168 height: root.__footerContentVisible() ? undefined : 0
169 padding: root.footerPaddingEnabled ? root.margins : 0
173 function __swapContentIntoContainer(property: string, container:
Item): void {
174 const content = this[property];
175 const rootContainer = container.parent;
177 if (content && content !== rootContainer) {
180 content.anchors.top = undefined;
182 this[property] = rootContainer;
183 container.contentItem = content;
187 function __adoptOverlaySheets(): void {
189 for (const object of contentItem.data) {
190 if (
object instanceof
Kirigami.OverlaySheet) {
191 if (
object.parent === null) {
192 object.parent =
this;
199 Component.onCompleted: {
200 __swapContentIntoContainer(
"header", headerParent);
201 __swapContentIntoContainer(
"footer", footerParent);
202 __adoptOverlaySheets();
QTextStream & left(QTextStream &stream)
QTextStream & right(QTextStream &stream)