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 id: root
13
14 required property int index
15 required property int kDescendantLevel
16 required property var kDescendantHasSiblings
17 required property bool kDescendantExpandable
18 required property bool kDescendantExpanded
19 required property T2.ItemDelegate parentDelegate
20 required property KDescendantsProxyModel model
21
22 Layout.topMargin: -parentDelegate.topPadding
23 Layout.bottomMargin: -parentDelegate.bottomPadding
25 Repeater {
26 model: kDescendantLevel - 1
27 delegate: StylePrivate.StyleItem {
28 Layout.preferredWidth: controlRoot.width
29 Layout.fillHeight: true
30 visible: true
31 elementType: "itembranchindicator"
32 properties: {
33 "isItem": false,
34 "hasSibling": kDescendantHasSiblings[modelData]
35 }
36 }
37 }
38
39 T2.Button {
40 id: controlRoot
41 Layout.preferredWidth: contentItem.pixelMetric("treeviewindentation")
42 Layout.fillHeight: true
43 enabled: root.kDescendantExpandable
44 onClicked: {
45 root.model.toggleChildren(root.parentDelegate.index)
46 }
47 contentItem: StylePrivate.StyleItem {
48 id: styleitem
49 control: controlRoot
50 hover: controlRoot.hovered
51 elementType: "itembranchindicator"
52 on: kDescendantExpanded
53 properties: {
54 "isItem": true,
55 "hasChildren": root.kDescendantExpandable,
56 "hasSibling": root.kDescendantHasSiblings[root.kDescendantHasSiblings.length - 1]
57 }
58 }
59 background: null
60 }
61}
KGuiItem properties()
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Jan 3 2025 11:46:31 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.