I want to create a filter to display the directories. The script works well with files, but does not work with directories. What am I doing wrong?
Qt Code:
  1. function updateFilter()
  2. {
  3. var text = searchField.text
  4. var filter = "*"
  5. for(var i = 0; i<text.length; i++)
  6. filter+= text[i]
  7. filter+="*"
  8. print(filter)
  9. folderDirModel.nameFilters = [filter]
  10. }
  11.  
  12. TextField{
  13. id: searchField
  14. width: parent.width
  15. font.pointSize: 16
  16. padding: 0
  17. visible: true
  18. onTextChanged: updateFilter()
  19. }
  20. ListView {
  21. id: dirView
  22. anchors.topMargin: 50
  23. anchors.leftMargin: 75
  24. antialiasing: false
  25. scale: 1
  26. spacing: 1
  27. anchors.fill: parent
  28. clip: true
  29. model: folderDirModel
  30. delegate: folderDeligate
  31.  
  32. FolderListModel {
  33. id: folderDirModel
  34. objectName: "folderDirModel"
  35. sortField: FolderListModel.Name
  36. showDirs: true
  37. showFiles: false
  38. folder: "file:///Users/public/Directory/"
  39. nameFilters: ["*.*"]
  40. }
To copy to clipboard, switch view to plain text mode