Legend.qml 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. // Copyright (c) 2015 Ultimaker B.V.
  2. // Cura is released under the terms of the AGPLv3 or higher.
  3. import QtQuick 2.2
  4. import QtQuick.Controls 1.1
  5. import QtQuick.Controls.Styles 1.1
  6. import QtQuick.Layouts 1.1
  7. import UM 1.1 as UM
  8. import Cura 1.0 as Cura
  9. Item {
  10. id: base
  11. UM.I18nCatalog { id: catalog; name:"cura"}
  12. width: childrenRect.width
  13. height: childrenRect.height
  14. Connections
  15. {
  16. target: Printer
  17. onViewLegendItemsChanged:
  18. {
  19. legendItemRepeater.model = items
  20. }
  21. }
  22. Column
  23. {
  24. Repeater
  25. {
  26. id: legendItemRepeater
  27. Item {
  28. anchors.right: parent.right
  29. height: childrenRect.height
  30. width: childrenRect.width
  31. Rectangle {
  32. id: swatch
  33. anchors.right: parent.right
  34. anchors.verticalCenter: label.verticalCenter
  35. height: UM.Theme.getSize("setting_control").height / 2
  36. width: height
  37. color: modelData.color
  38. border.width: UM.Theme.getSize("default_lining").width
  39. border.color: UM.Theme.getColor("text_subtext")
  40. }
  41. Label {
  42. id: label
  43. text: modelData.title
  44. font: UM.Theme.getFont("small")
  45. color: UM.Theme.getColor("text_subtext")
  46. anchors.right: swatch.left
  47. anchors.rightMargin: UM.Theme.getSize("default_margin").width / 2
  48. }
  49. }
  50. }
  51. }
  52. }