ToolboxDownloadsGrid.qml 1.3 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.2
  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
  11. width: parent.width
  12. spacing: UM.Theme.getSize("default_margin").height
  13. Label
  14. {
  15. id: heading
  16. text: toolbox.viewCategory == "material" ? catalog.i18nc("@label", "Community contributions") : catalog.i18nc("@label", "Community plugins")
  17. width: parent.width
  18. color: UM.Theme.getColor("text_medium")
  19. font: UM.Theme.getFont("medium")
  20. }
  21. GridLayout
  22. {
  23. id: grid
  24. property var model: toolbox.viewCategory == "material" ? toolbox.authorsModel : toolbox.packagesModel
  25. width: parent.width
  26. columns: 2
  27. columnSpacing: UM.Theme.getSize("default_margin").height
  28. rowSpacing: UM.Theme.getSize("default_margin").width
  29. Repeater
  30. {
  31. model: grid.model
  32. delegate: ToolboxDownloadsGridTile
  33. {
  34. Layout.preferredWidth: (grid.width - (grid.columns - 1) * grid.columnSpacing) / grid.columns
  35. Layout.preferredHeight: UM.Theme.getSize("toolbox_thumbnail_small").height
  36. }
  37. }
  38. }
  39. }