ToolboxDownloadsGrid.qml 1.2 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. // TODO: Switch to QtQuick.Controls 2.x and remove QtQuick.Controls.Styles
  9. Column
  10. {
  11. id: base
  12. height: childrenRect.height
  13. spacing: UM.Theme.getSize("base_unit").height
  14. Label
  15. {
  16. id: heading
  17. text: toolbox.viewCategory == "material" ? catalog.i18nc("@label", "Maker Choices") : 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. width: parent.width
  26. columns: 2
  27. columnSpacing: UM.Theme.getSize("base_unit").width
  28. rowSpacing: UM.Theme.getSize("base_unit").height
  29. Repeater
  30. {
  31. model: toolbox.viewCategory == "material" ? toolbox.authorsModel : toolbox.packagesModel
  32. delegate: ToolboxDownloadsGridTile
  33. {
  34. Layout.preferredWidth: (grid.width - (grid.columns - 1) * grid.columnSpacing) / grid.columns
  35. }
  36. }
  37. }
  38. }