Warning, /graphics/arianna/src/content/ui/TableOfContentDrawer.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 import org.kde.arianna 0013 0014 Kirigami.OverlayDrawer { 0015 id: root 0016 0017 property alias model: tableOfContentModel 0018 signal goTo(cfi: string) 0019 0020 width: Kirigami.Units.gridUnit * 20 0021 edge: Qt.application.layoutDirection == Qt.RightToLeft ? Qt.LeftEdge : Qt.RightEdge 0022 handleClosedIcon.name: 'format-list-ordered' 0023 handleClosedToolTip: i18nc("@info:tooltip", "Open table of contents") 0024 handleOpenToolTip: i18nc("@info:tooltip", "Close table of contents") 0025 0026 topPadding: 0 0027 leftPadding: 0 0028 rightPadding: 0 0029 0030 Kirigami.Theme.colorSet: Kirigami.Theme.View 0031 0032 contentItem: ColumnLayout { 0033 spacing: 0 0034 0035 QQC2.ToolBar { 0036 Layout.fillWidth: true 0037 Layout.preferredHeight: applicationWindow().pageStack.globalToolBar.preferredHeight 0038 0039 leftPadding: Kirigami.Units.largeSpacing 0040 rightPadding: Kirigami.Units.smallSpacing 0041 topPadding: Kirigami.Units.smallSpacing 0042 bottomPadding: Kirigami.Units.smallSpacing 0043 0044 Kirigami.Heading { 0045 text: i18nc("@info:title", "Table of Contents") 0046 } 0047 } 0048 0049 QQC2.ScrollView { 0050 Layout.fillWidth: true 0051 Layout.fillHeight: true 0052 0053 ListView { 0054 id: treeView 0055 0056 contentWidth: parent.availableWidth 0057 0058 model: KDescendantsProxyModel { 0059 model: TableOfContentModel { 0060 id: tableOfContentModel 0061 } 0062 } 0063 0064 delegate: Delegates.RoundedTreeDelegate { 0065 id: itemDelegate 0066 0067 required property string title 0068 required property string href 0069 0070 text: title 0071 0072 onClicked: root.goTo(href) 0073 } 0074 } 0075 } 0076 } 0077 }