Try to use QSortFilterProxyModel via cxx-qt.

This may be easier if I just wrap a QAbstractItemModel in C++ and use
cxx-qt to pull it into QML? That way I could do C++ pointer things in
C++ and rust things in rust.
This commit is contained in:
2026-01-31 21:47:19 -05:00
parent aa8590cd5c
commit 325cf285fc
2 changed files with 124 additions and 21 deletions

View File

@@ -16,20 +16,23 @@ Rectangle {
signal fileClicked(string filePath)
// https://doc.qt.io/qt-6/qml-qtquick-treeview.html
TreeView {
id: fileSystemTreeView
anchors.margins: 15
property int lastIndex: -1
model: FileSystem
model: FileSystemSortProxyModel {
id: fs
}
anchors.fill: parent
boundsBehavior: Flickable.StopAtBounds
boundsMovement: Flickable.StopAtBounds
clip: true
Component.onCompleted: {
FileSystem.setDirectory(root.rootDirectory)
fs.setDirectory(root.rootDirectory)
fileSystemTreeView.expandRecursively(0, -1)
}
@@ -122,13 +125,13 @@ Rectangle {
text: qsTr("Set as root index")
onTriggered: {
console.log("Setting directory: " + treeDelegate.filePath)
FileSystem.setDirectory(treeDelegate.filePath)
FileSystemSortProxyModel.setDirectory(treeDelegate.filePath)
}
}
Action {
text: qsTr("Reset root index")
onTriggered: {
FileSystem.setDirectory("")
FileSystemSortProxyModel.setDirectory("")
}
}
}