diff options
author | Matias Linares <matias.linares@comprandoengrupo.net> | 2024-10-14 09:54:47 -0300 |
---|---|---|
committer | Matias Linares <matias.linares@comprandoengrupo.net> | 2024-10-14 09:54:47 -0300 |
commit | bbe83e74b2c1335a0a726c2f993bb2d8c47ffedc (patch) | |
tree | 3a8b772c4900708e3f00edac2ad723e8930d0bc3 /kodereviewer/qml/FilesDrawer.qml | |
parent | 522fdc2402443fd37665e2764d1367f7dad2a5b5 (diff) | |
download | kodereviewer-bbe83e74b2c1335a0a726c2f993bb2d8c47ffedc.tar.gz |
Functioning context drawermain
Diffstat (limited to 'kodereviewer/qml/FilesDrawer.qml')
-rw-r--r-- | kodereviewer/qml/FilesDrawer.qml | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/kodereviewer/qml/FilesDrawer.qml b/kodereviewer/qml/FilesDrawer.qml new file mode 100644 index 0000000..3f98290 --- /dev/null +++ b/kodereviewer/qml/FilesDrawer.qml @@ -0,0 +1,70 @@ +import QtQuick +import QtQuick.Controls as QQC2 +import QtQuick.Layouts +import org.kde.kirigami as Kirigami +import org.kde.kirigamiaddons.delegates as Delegates +import org.kde.kitemmodels + +import org.deprecated.kodereviewer 1.0 + + +Kirigami.ContextDrawer { + id: contextDrawer + modal: false + handleVisible: false + property alias model: descendantsModel.model + width: Kirigami.Units.gridUnit * 20 + + signal fileSelected(string filename, string text) + + contentItem: ColumnLayout { + id: mainLayout + implicitWidth: Kirigami.Units.gridUnit * 20 + QQC2.ToolBar { + id: toolbar + Layout.fillWidth: true + + Layout.preferredHeight: pageStack.globalToolBar.preferredHeight + + contentItem: RowLayout { + Kirigami.Heading { + Layout.fillWidth: true + text: "Files" + } + } + } + + QQC2.ScrollView { + Layout.fillWidth: true + Layout.fillHeight: true + + ListView { + anchors.fill: parent + clip: true + id: menu + model: KDescendantsProxyModel { + id: descendantsModel + } + + delegate: Delegates.RoundedTreeDelegate { + padding: 4 + required property string filename + required property string iconName + required property string path + required property string patch + required property bool isFile + text: filename + icon.name: iconName + + highlighted: menu.currentItem ? menu.currentItem.path == path : false + onClicked: { + menu.currentIndex = index + if (isFile) { + contextDrawer.fileSelected(filename, patch) + } + } + } + } + } + } +} |