Warning, /frameworks/kitemmodels/tests/proxymodeltestapp/tree.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 SPDX-FileCopyrightText: 2020 Marco Martin <mart@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 import QtQuick 2.6 0007 import QtQuick.Layouts 1.4 0008 import QtQuick.Controls 2.2 as QQC2 0009 import org.kde.kirigami 2.13 as Kirigami 0010 import org.kde.kitemmodels 1.0 0011 import org.kde.qqc2desktopstyle.private 1.0 as StylePrivate 0012 0013 0014 QQC2.ScrollView { 0015 id: root 0016 width: 600 0017 height: 500 0018 0019 ListView { 0020 spacing: 0 0021 clip: true 0022 add: Transition { 0023 NumberAnimation { 0024 property: "opacity"; from: 0; to: 1; duration: 250 } 0025 } 0026 addDisplaced: Transition { 0027 NumberAnimation { properties: "y"; duration: 250 } 0028 } 0029 remove: Transition { 0030 NumberAnimation { 0031 property: "opacity"; from: 1; to: 0; duration: 250 } 0032 } 0033 removeDisplaced: Transition { 0034 NumberAnimation { properties: "y"; duration: 250 } 0035 } 0036 model: KDescendantsProxyModel { 0037 id: descendantsModel 0038 expandsByDefault: false 0039 model: _model 0040 } 0041 0042 delegate: Kirigami.AbstractListItem { 0043 id: delegate 0044 highlighted: false 0045 separatorVisible: false 0046 0047 contentItem: RowLayout { 0048 RowLayout { 0049 Layout.topMargin: -delegate.topPadding 0050 Layout.bottomMargin: -delegate.bottomPadding 0051 Repeater { 0052 0053 model: kDescendantLevel-1 0054 0055 delegate: StylePrivate.StyleItem { 0056 Layout.preferredWidth: controlRoot.width//Kirigami.Units.gridUnit 0057 Layout.fillHeight: true 0058 visible: true 0059 // control: controlRoot 0060 elementType: "itembranchindicator" 0061 properties: { 0062 "isItem": false, 0063 "hasSibling": kDescendantHasSiblings[modelData] 0064 } 0065 } 0066 } 0067 QQC2.Button { 0068 id: controlRoot 0069 Layout.preferredWidth: background.pixelMetric("treeviewindentation") 0070 Layout.fillHeight: true 0071 enabled: model.kDescendantExpandable 0072 text: model.kDescendantExpanded ? "-" : "+" 0073 onClicked: descendantsModel.toggleChildren(index) 0074 background: StylePrivate.StyleItem { 0075 id: styleitem 0076 control: controlRoot 0077 hover: controlRoot.hovered 0078 elementType: "itembranchindicator" 0079 on: model.kDescendantExpanded 0080 properties: { 0081 "isItem": true, 0082 "hasChildren": model.kDescendantExpandable, 0083 "hasSibling": model.kDescendantHasSiblings[model.kDescendantHasSiblings.length - 1] 0084 } 0085 } 0086 } 0087 } 0088 0089 QQC2.Label { 0090 Layout.fillWidth: true 0091 text: model.display 0092 } 0093 } 0094 } 0095 } 0096 }