Warning, /libraries/kirigami-addons/src/treeview/qml/styles/org.kde.desktop/TreeViewDecoration.qml is written in an unsupported language. File is not indexed.

0001 //  SPDX-FileCopyrightText: 2020 Marco Martin <mart@kde.org>
0002 //  SPDX-License-Identifier: LGPL-2.0-or-later
0003 
0004 import QtQuick 2.6
0005 import QtQuick.Layouts 1.4
0006 import QtQuick.Controls 2.2 as QQC2
0007 import QtQuick.Templates 2.2 as T2
0008 import org.kde.kitemmodels 1.0
0009 import org.kde.qqc2desktopstyle.private as StylePrivate
0010 
0011 RowLayout {
0012     required property int index
0013     required property int kDescendantLevel
0014     required property var kDescendantHasSiblings
0015     required property bool kDescendantExpandable
0016     required property bool kDescendantExpanded
0017     required property T2.ItemDelegate parentDelegate
0018     required property KDescendantsProxyModel model
0019 
0020     Layout.topMargin: -parentDelegate.topPadding
0021     Layout.bottomMargin: -parentDelegate.bottomPadding
0022 
0023     Repeater {
0024         model: kDescendantLevel - 1
0025         delegate: StylePrivate.StyleItem {
0026             Layout.preferredWidth: controlRoot.width
0027             Layout.fillHeight: true
0028             visible: true
0029             elementType: "itembranchindicator"
0030             properties: {
0031                 "isItem": false,
0032                 "hasSibling": kDescendantHasSiblings[modelData]
0033             }
0034         }
0035     }
0036 
0037     T2.Button {
0038         id: controlRoot
0039         Layout.preferredWidth: contentItem.pixelMetric("treeviewindentation")
0040         Layout.fillHeight: true
0041         enabled: kDescendantExpandable
0042         onClicked: model.toggleChildren(index)
0043         contentItem: StylePrivate.StyleItem {
0044             id: styleitem
0045             control: controlRoot
0046             hover: controlRoot.hovered
0047             elementType: "itembranchindicator"
0048             on: kDescendantExpanded
0049             properties: {
0050                 "isItem": true,
0051                 "hasChildren": kDescendantExpandable,
0052                 "hasSibling": kDescendantHasSiblings[kDescendantHasSiblings.length - 1]
0053             }
0054         }
0055         background: null
0056     }
0057 }