Warning, /plasma/plasma-systemmonitor/src/table/TreeDecoration.qml is written in an unsupported language. File is not indexed.

0001 /*
0002  * SPDX-FileCopyrightText: 2020 Arjen Hiemstra <ahiemstra@heimr.nl>
0003  *
0004  * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005  */
0006 
0007 import QtQuick 2.12
0008 import QtQuick.Controls 2.12
0009 import QtQuick.Layouts 1.12
0010 
0011 import org.kde.qqc2desktopstyle.private 1.0 as StylePrivate
0012 
0013 RowLayout {
0014     id: root
0015     required property var hasSiblings
0016     required property int level
0017     property alias expandable : controlRoot.enabled
0018     required property bool expanded
0019     signal clicked
0020     Layout.topMargin: -delegate.topPadding
0021     Layout.bottomMargin: -delegate.bottomPadding
0022     Repeater {
0023         model: root.level - 1
0024         delegate: StylePrivate.StyleItem {
0025             Layout.preferredWidth: controlRoot.Layout.preferredWidth
0026             Layout.fillHeight: true
0027             visible: true
0028             control: controlRoot
0029             elementType: "itembranchindicator"
0030             properties: {
0031                 "isItem": false,
0032                 "hasSibling": root.hasSiblings[modelData]
0033             }
0034         }
0035     }
0036     Button {
0037         id: controlRoot
0038         Layout.preferredWidth: background.pixelMetric("treeviewindentation")
0039         visible: true
0040         Layout.fillHeight: true
0041         text: root.expanded ? "-" : "+"
0042         onClicked: root.clicked()
0043         background: StylePrivate.StyleItem {
0044             id: styleitem
0045             control: controlRoot
0046             hover: controlRoot.hovered
0047             elementType: "itembranchindicator"
0048             on: root.expanded
0049             properties: {
0050                 "isItem": true,
0051                 "hasChildren": root.expandable,
0052                 "hasSibling": root.hasSiblings[root.hasSiblings.length - 1]
0053             }
0054         }
0055     }
0056 }