ToolboxDownloadsGrid.qml 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // Copyright (c) 2018 Ultimaker B.V.
  2. // Toolbox is released under the terms of the LGPLv3 or higher.
  3. import QtQuick 2.7
  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. height: childrenRect.height + 2 * padding
  11. width: parent.width
  12. spacing: UM.Theme.getSize("default_margin").height
  13. padding: UM.Theme.getSize("wide_margin").height
  14. Label
  15. {
  16. id: heading
  17. text: toolbox.viewCategory == "material" ? catalog.i18nc("@label", "Community contributions") : catalog.i18nc("@label", "Community plugins")
  18. width: parent.width
  19. color: UM.Theme.getColor("text_medium")
  20. font: UM.Theme.getFont("medium")
  21. }
  22. GridLayout
  23. {
  24. id: grid
  25. property var model: toolbox.viewCategory == "material" ? toolbox.authorsModel : toolbox.packagesModel
  26. width: parent.width - 2 * parent.padding
  27. columns: 2
  28. columnSpacing: UM.Theme.getSize("default_margin").height
  29. rowSpacing: UM.Theme.getSize("default_margin").width
  30. Repeater
  31. {
  32. model: grid.model
  33. delegate: ToolboxDownloadsGridTile
  34. {
  35. Layout.preferredWidth: (grid.width - (grid.columns - 1) * grid.columnSpacing) / grid.columns
  36. Layout.preferredHeight: UM.Theme.getSize("toolbox_thumbnail_small").height
  37. }
  38. }
  39. }
  40. }