KDeclarative

AbstractKCM.qml
1 /*
2  SPDX-FileCopyrightText: 2020 Marco Martin <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 import QtQuick 2.7
8 import QtQuick.Controls 2.2 as QtControls
9 import org.kde.kirigami 2.14 as Kirigami
10 import org.kde.kcm 1.1 as KCM
11 
35 Kirigami.Page {
36  id: root
37 
38  title: kcm.name
39 
40  // Make pages fill the whole view by default
41  Kirigami.ColumnView.fillWidth: true
42 
43  leftPadding: 6 // Layout_ChildMarginWidth from Breeze
44  topPadding: headerParent.contentItem ? 0 : leftPadding
45  rightPadding: leftPadding
46  bottomPadding: footerParent.contentItem ? 0 : leftPadding
47 
48  header: QtControls.Control {
49  id: headerParent
50  height: contentItem ? implicitHeight : 0
51  leftPadding: 6 // Layout_ChildMarginWidth from Breeze
52  topPadding: leftPadding
53  rightPadding: leftPadding
54  bottomPadding: leftPadding
55  }
56 
57  footer: QtControls.Control {
58  id: footerParent
59  height: contentItem ? implicitHeight : 0
60  leftPadding: 6 // Layout_ChildMarginWidth from Breeze
61  topPadding: leftPadding
62  rightPadding: leftPadding
63  bottomPadding: leftPadding
64  }
65 
66  Component.onCompleted: {
67  if (footer && footer != footerParent) {
68  var f = footer
69 
70  footerParent.contentItem = f
71  footer = footerParent
72  footer.visible = true
73  f.parent = footerParent
74  }
75 
76  if (header && header != headerParent) {
77  var h = header
78 
79  headerParent.contentItem = h
80  header = headerParent
81  header.visible = true
82  h.parent = headerParent
83  }
84 
85  //Search overlaysheets in contentItem, parent to root if found
86  for (let i in contentItem.data) {
87  let child = contentItem.data[i];
88  if (child instanceof Kirigami.OverlaySheet) {
89  if (!child.parent) {
90  child.parent = root;
91  }
92  root.data.push(child);
93  }
94  }
95  }
96 }
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Mon Jan 25 2021 22:44:28 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.