ProfileTab.qml 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. // Copyright (c) 2018 Ultimaker B.V.
  2. // Cura is released under the terms of the LGPLv3 or higher.
  3. import QtQuick 2.7
  4. import QtQuick.Controls 1.4
  5. import UM 1.2 as UM
  6. import Cura 1.0 as Cura
  7. Tab
  8. {
  9. id: base
  10. property int extruderPosition: -1 //Denotes the global stack.
  11. property var qualityItem: null
  12. property bool isQualityItemCurrentlyActivated:
  13. {
  14. if (qualityItem == null)
  15. {
  16. return false;
  17. }
  18. return qualityItem.name == Cura.MachineManager.activeQualityOrQualityChangesName;
  19. }
  20. TableView
  21. {
  22. anchors.fill: parent
  23. anchors.margins: UM.Theme.getSize("default_margin").width
  24. Component
  25. {
  26. id: itemDelegate
  27. UM.TooltipArea
  28. {
  29. property var setting: qualitySettings.getItem(styleData.row)
  30. height: childrenRect.height
  31. width: (parent != null) ? parent.width : 0
  32. text: (styleData.value.substr(0,1) == "=") ? styleData.value : ""
  33. Label
  34. {
  35. anchors.left: parent.left
  36. anchors.leftMargin: UM.Theme.getSize("default_margin").width
  37. anchors.right: parent.right
  38. text: (styleData.value.substr(0,1) == "=") ? catalog.i18nc("@info:status", "Calculated") : styleData.value
  39. font.strikeout: styleData.column == 1 && setting.user_value != "" && base.isQualityItemCurrentlyActivated
  40. font.italic: setting.profile_value_source == "quality_changes" || (setting.user_value != "" && base.isQualityItemCurrentlyActivated)
  41. opacity: font.strikeout ? 0.5 : 1
  42. color: styleData.textColor
  43. elide: Text.ElideRight
  44. }
  45. }
  46. }
  47. TableViewColumn
  48. {
  49. role: "label"
  50. title: catalog.i18nc("@title:column", "Setting")
  51. width: (parent.width * 0.4) | 0
  52. delegate: itemDelegate
  53. }
  54. TableViewColumn
  55. {
  56. role: "profile_value"
  57. title: catalog.i18nc("@title:column", "Profile")
  58. width: (parent.width * 0.18) | 0
  59. delegate: itemDelegate
  60. }
  61. TableViewColumn
  62. {
  63. role: "user_value"
  64. title: catalog.i18nc("@title:column", "Current");
  65. visible: base.isQualityItemCurrentlyActivated
  66. width: (parent.width * 0.18) | 0
  67. delegate: itemDelegate
  68. }
  69. TableViewColumn
  70. {
  71. role: "unit"
  72. title: catalog.i18nc("@title:column", "Unit")
  73. width: (parent.width * 0.14) | 0
  74. delegate: itemDelegate
  75. }
  76. section.property: "category"
  77. section.delegate: Label
  78. {
  79. text: section
  80. font.bold: true
  81. }
  82. model: Cura.QualitySettingsModel
  83. {
  84. id: qualitySettings
  85. selectedPosition: base.extruderPosition
  86. selectedQualityItem: base.qualityItem == null ? {} : base.qualityItem
  87. }
  88. SystemPalette { id: palette }
  89. }
  90. }