KDeclarative

SimpleKCM.qml
1 /*
2  SPDX-FileCopyrightText: 2017 Marco Martin <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-only
5 */
6 
7 import QtQuick 2.7
8 import QtQuick.Controls 2.2 as QtControls
9 import org.kde.kirigami 2.2 as Kirigami
10 import org.kde.kcm 1.1 as KCM
11 
34 Kirigami.ScrollablePage {
35  id: root
36 
37  title: kcm.name
38 
39  leftPadding: Kirigami.Settings.isMobile ? 0 : 4
40  topPadding: headerParent.contentItem ? 0 : (Kirigami.Settings.isMobile ? 0 : 4)
41  rightPadding: (Kirigami.Settings.isMobile ? 0 : 4)
42  bottomPadding: footerParent.contentItem ? 0 : (Kirigami.Settings.isMobile ? 0 : 4)
43 
44  header: QtControls.Control {
45  id: headerParent
46  visible: contentItem ? contentItem.visible : false
47  height: visible ? implicitHeight : 0
48  leftPadding: 4
49  topPadding: 4
50  rightPadding: 4
51  bottomPadding: 4
52  }
53 
54  footer: QtControls.Control {
55  id: footerParent
56  visible: contentItem ? contentItem.visible : false
57  height: visible ? implicitHeight : 0
58  leftPadding: 4
59  topPadding: 4
60  rightPadding: 4
61  bottomPadding: 4
62  }
63 
64  Component.onCompleted: {
65  if (footer && footer != footerParent) {
66  var f = footer
67 
68  footerParent.contentItem = f
69  footer = footerParent
70  footer.visible = true
71  f.parent = footerParent
72  }
73 
74  if (header && header != headerParent) {
75  var h = header
76 
77  headerParent.contentItem = h
78  header = headerParent
79  header.visible = true
80  h.parent = headerParent
81  }
82  }
83 
84  children: [
85  Kirigami.Separator {
86  z: 999
87  anchors {
88  left: parent.left
89  right: parent.right
90  top: parent.top
91  topMargin: root.header.visible ? root.header.height : 0
92  }
93  visible: !root.flickable.atYBeginning && !Kirigami.Settings.isMobile
94  },
95  Kirigami.Separator {
96  z: 999
97  anchors {
98  left: parent.left
99  right: parent.right
100  bottom: parent.bottom
101  bottomMargin: root.footer.visible ? root.footer.height : 0
102  }
103  visible: !root.flickable.atYEnd && !Kirigami.Settings.isMobile
104  }
105  ]
106 }
QTextStream & left(QTextStream &s)
QTextStream & right(QTextStream &s)
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Tue Aug 11 2020 22:40:17 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.