Warning, /libraries/kirigami-addons/src/delegates/RoundedTreeDelegate.qml is written in an unsupported language. File is not indexed.
0001 // SPDX-FileCopyrightText: 2023 Carl Schwan <carl@carlschwan.eu>
0002 // SPDX-License-Identifier: LGPL-2.1-only or LGPL-3.0-only or LicenseRef-KDE-Accepted-LGPL
0003
0004 import QtQuick
0005 import QtQuick.Controls 2 as QQC2
0006 import QtQuick.Layouts
0007
0008 import org.kde.kirigami 2 as Kirigami
0009 import org.kde.kirigamiaddons.delegates 1 as Delegates
0010 import org.kde.kirigamiaddons.treeview 1.0 as Tree
0011 import org.kde.kitemmodels 1
0012
0013 /**
0014 * Rounded item delegate meant to be used in combination with
0015 * a ListView and a KDescendantsProxyModel to create a TreeView.
0016 *
0017 * @since KirigamiAddons 0.12.0
0018 */
0019 Delegates.RoundedItemDelegate {
0020 id: root
0021
0022 required property int index
0023 required property int kDescendantLevel
0024 required property var kDescendantHasSiblings
0025 required property bool kDescendantExpandable
0026 required property bool kDescendantExpanded
0027
0028 leftInset: (Qt.application.layoutDirection !== Qt.RightToLeft ? decoration.width + root.padding * 2 : 0)
0029 leftPadding: (Qt.application.layoutDirection !== Qt.RightToLeft ? decoration.width + root.padding * 2 : 0) + Kirigami.Units.smallSpacing
0030
0031 rightInset: (Qt.application.layoutDirection === Qt.RightToLeft ? decoration.width + root.padding * 2 : 0) + Kirigami.Units.smallSpacing
0032 rightPadding: (Qt.application.layoutDirection === Qt.RightToLeft ? decoration.width + root.padding * 2 : 0) + Kirigami.Units.smallSpacing * 2
0033
0034 data: Tree.TreeViewDecoration {
0035 id: decoration
0036
0037 parent: root
0038 parentDelegate: root
0039 model: root.ListView.view.model
0040
0041 index: root.index
0042 kDescendantLevel: root.kDescendantLevel
0043 kDescendantHasSiblings: root.kDescendantHasSiblings
0044 kDescendantExpandable: root.kDescendantExpandable
0045 kDescendantExpanded: root.kDescendantExpanded
0046
0047 anchors {
0048 left: parent.left
0049 top: parent.top
0050 bottom: parent.bottom
0051 leftMargin: parent.padding
0052 }
0053 }
0054 }