PatternListPage.qml 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. import QtQuick 2.15
  2. import QtQuick.Controls 2.15
  3. import QtQuick.Layouts 1.15
  4. import "../components"
  5. Page {
  6. id: page
  7. header: ToolBar {
  8. RowLayout {
  9. anchors.fill: parent
  10. anchors.margins: 10
  11. TextField {
  12. id: searchField
  13. Layout.fillWidth: true
  14. placeholderText: "Search patterns..."
  15. onTextChanged: patternModel.filter(text)
  16. font.pixelSize: 16
  17. }
  18. Button {
  19. text: "Playlists"
  20. Layout.preferredHeight: 50
  21. font.pixelSize: 16
  22. onClicked: stackView.push("PlaylistPage.qml")
  23. }
  24. }
  25. }
  26. GridView {
  27. id: gridView
  28. anchors.fill: parent
  29. anchors.margins: 10
  30. cellWidth: 200
  31. cellHeight: 250
  32. model: patternModel
  33. delegate: PatternCard {
  34. width: gridView.cellWidth - 10
  35. height: gridView.cellHeight - 10
  36. name: model.name
  37. preview: model.preview
  38. onClicked: {
  39. stackView.push("PatternDetailPage.qml", {
  40. patternName: model.name,
  41. patternPath: model.path,
  42. patternPreview: model.preview
  43. })
  44. }
  45. }
  46. }
  47. BusyIndicator {
  48. anchors.centerIn: parent
  49. running: patternModel.rowCount() === 0
  50. visible: running
  51. }
  52. Label {
  53. anchors.centerIn: parent
  54. text: "No patterns found"
  55. visible: patternModel.rowCount() === 0 && searchField.text !== ""
  56. color: "#999"
  57. font.pixelSize: 18
  58. }
  59. }