Kirigami-addons

styles/org.kde.desktop/TreeViewDecoration.qml
1// SPDX-FileCopyrightText: 2020 Marco Martin <mart@kde.org>
2// SPDX-License-Identifier: LGPL-2.0-or-later
3
4import QtQuick 2.6
5import QtQuick.Layouts 1.4
6import QtQuick.Controls 2.2 as QQC2
7import QtQuick.Templates 2.2 as T2
8import org.kde.kitemmodels 1.0
9import org.kde.qqc2desktopstyle.private as StylePrivate
10
11RowLayout {
12 required property int index
13 required property int kDescendantLevel
14 required property var kDescendantHasSiblings
15 required property bool kDescendantExpandable
16 required property bool kDescendantExpanded
17 required property T2.ItemDelegate parentDelegate
18 required property KDescendantsProxyModel model
19
20 Layout.topMargin: -parentDelegate.topPadding
21 Layout.bottomMargin: -parentDelegate.bottomPadding
23 Repeater {
24 model: kDescendantLevel - 1
25 delegate: StylePrivate.StyleItem {
26 Layout.preferredWidth: controlRoot.width
27 Layout.fillHeight: true
28 visible: true
29 elementType: "itembranchindicator"
30 properties: {
31 "isItem": false,
32 "hasSibling": kDescendantHasSiblings[modelData]
33 }
34 }
35 }
36
37 T2.Button {
38 id: controlRoot
39 Layout.preferredWidth: contentItem.pixelMetric("treeviewindentation")
40 Layout.fillHeight: true
41 enabled: kDescendantExpandable
42 onClicked: model.toggleChildren(index)
43 contentItem: StylePrivate.StyleItem {
44 id: styleitem
45 control: controlRoot
46 hover: controlRoot.hovered
47 elementType: "itembranchindicator"
48 on: kDescendantExpanded
49 properties: {
50 "isItem": true,
51 "hasChildren": kDescendantExpandable,
52 "hasSibling": kDescendantHasSiblings[kDescendantHasSiblings.length - 1]
53 }
54 }
55 background: null
56 }
57}
KGuiItem properties()
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:12:26 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.