ToolboxDownloadsGrid.qml 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. // Copyright (c) 2018 Ultimaker B.V.
  2. // Toolbox is released under the terms of the LGPLv3 or higher.
  3. import QtQuick 2.10
  4. import QtQuick.Controls 1.4
  5. import QtQuick.Controls.Styles 1.4
  6. import QtQuick.Layouts 1.3
  7. import UM 1.1 as UM
  8. Column
  9. {
  10. property var heading: ""
  11. property var model
  12. id: gridArea
  13. height: childrenRect.height + 2 * padding
  14. width: parent.width
  15. spacing: UM.Theme.getSize("default_margin").height
  16. padding: UM.Theme.getSize("wide_margin").height
  17. Label
  18. {
  19. id: heading
  20. text: gridArea.heading
  21. width: parent.width
  22. color: UM.Theme.getColor("text_medium")
  23. font: UM.Theme.getFont("large")
  24. renderType: Text.NativeRendering
  25. }
  26. Grid
  27. {
  28. id: grid
  29. width: parent.width - 2 * parent.padding
  30. columns: 2
  31. columnSpacing: UM.Theme.getSize("default_margin").height
  32. rowSpacing: UM.Theme.getSize("default_margin").width
  33. Repeater
  34. {
  35. model: gridArea.model
  36. delegate: Loader
  37. {
  38. asynchronous: true
  39. width: Math.round((grid.width - (grid.columns - 1) * grid.columnSpacing) / grid.columns)
  40. height: UM.Theme.getSize("toolbox_thumbnail_small").height
  41. source: "ToolboxDownloadsGridTile.qml"
  42. }
  43. }
  44. }
  45. }