ProfileTab.qml 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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. id: profileSettingsView
  25. Component
  26. {
  27. id: itemDelegate
  28. UM.TooltipArea
  29. {
  30. property var setting: qualitySettings.getItem(styleData.row)
  31. height: childrenRect.height
  32. width: (parent != null) ? parent.width : 0
  33. text:
  34. {
  35. if (styleData.value === undefined)
  36. {
  37. return ""
  38. }
  39. return (styleData.value.substr(0,1) == "=") ? styleData.value : ""
  40. }
  41. Label
  42. {
  43. anchors.left: parent.left
  44. anchors.leftMargin: UM.Theme.getSize("default_margin").width
  45. anchors.right: parent.right
  46. text:
  47. {
  48. if (styleData.value === undefined)
  49. {
  50. return ""
  51. }
  52. return (styleData.value.substr(0,1) == "=") ? catalog.i18nc("@info:status", "Calculated") : styleData.value
  53. }
  54. font.strikeout: styleData.column == 1 && setting.user_value != "" && base.isQualityItemCurrentlyActivated
  55. font.italic: setting.profile_value_source == "quality_changes" || (setting.user_value != "" && base.isQualityItemCurrentlyActivated)
  56. opacity: font.strikeout ? 0.5 : 1
  57. color: styleData.textColor
  58. elide: Text.ElideRight
  59. }
  60. }
  61. }
  62. TableViewColumn
  63. {
  64. role: "label"
  65. title: catalog.i18nc("@title:column", "Setting")
  66. width: (parent.width * 0.4) | 0
  67. delegate: itemDelegate
  68. }
  69. TableViewColumn
  70. {
  71. role: "profile_value"
  72. title: catalog.i18nc("@title:column", "Profile")
  73. width: (parent.width * 0.18) | 0
  74. delegate: itemDelegate
  75. }
  76. TableViewColumn
  77. {
  78. role: "user_value"
  79. title: catalog.i18nc("@title:column", "Current");
  80. visible: base.isQualityItemCurrentlyActivated
  81. width: (parent.width * 0.18) | 0
  82. delegate: itemDelegate
  83. }
  84. TableViewColumn
  85. {
  86. role: "unit"
  87. title: catalog.i18nc("@title:column", "Unit")
  88. width: (parent.width * 0.14) | 0
  89. delegate: itemDelegate
  90. }
  91. section.property: "category"
  92. section.delegate: Label
  93. {
  94. text: section
  95. font.bold: true
  96. }
  97. model: Cura.QualitySettingsModel
  98. {
  99. id: qualitySettings
  100. selectedPosition: base.extruderPosition
  101. selectedQualityItem: base.qualityItem == null ? {} : base.qualityItem
  102. }
  103. SystemPalette { id: palette }
  104. }
  105. }