RecommendedQualityProfileSelector.qml 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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 QtQuick.Controls 2.3 as Controls2
  6. import QtQuick.Controls.Styles 1.4
  7. import UM 1.2 as UM
  8. import Cura 1.6 as Cura
  9. Item
  10. {
  11. id: qualityRow
  12. height: childrenRect.height
  13. property real labelColumnWidth: Math.round(width / 3)
  14. property real settingsColumnWidth: width - labelColumnWidth
  15. // Here are the elements that are shown in the left column
  16. Column
  17. {
  18. anchors
  19. {
  20. left: parent.left
  21. right: parent.right
  22. }
  23. spacing: UM.Theme.getSize("default_margin").height
  24. Controls2.ButtonGroup
  25. {
  26. id: activeProfileButtonGroup
  27. exclusive: true
  28. onClicked: Cura.IntentManager.selectIntent(button.modelData.intent_category, button.modelData.quality_type)
  29. }
  30. Item
  31. {
  32. height: childrenRect.height
  33. anchors
  34. {
  35. left: parent.left
  36. right: parent.right
  37. }
  38. Cura.IconWithText
  39. {
  40. id: profileLabel
  41. source: UM.Theme.getIcon("category_layer_height")
  42. text: catalog.i18nc("@label", "Profiles")
  43. font: UM.Theme.getFont("medium")
  44. width: labelColumnWidth
  45. }
  46. Cura.LabelBar
  47. {
  48. id: labelbar
  49. anchors
  50. {
  51. left: profileLabel.right
  52. right: parent.right
  53. }
  54. model: Cura.QualityProfilesDropDownMenuModel
  55. modelKey: "layer_height"
  56. }
  57. }
  58. Repeater
  59. {
  60. model: Cura.IntentCategoryModel {}
  61. Item
  62. {
  63. anchors
  64. {
  65. left: parent.left
  66. right: parent.right
  67. }
  68. height: intentCategoryLabel.height
  69. Label
  70. {
  71. id: intentCategoryLabel
  72. text: model.name
  73. width: labelColumnWidth - UM.Theme.getSize("section_icon").width
  74. anchors.left: parent.left
  75. anchors.leftMargin: UM.Theme.getSize("section_icon").width + UM.Theme.getSize("narrow_margin").width
  76. font: UM.Theme.getFont("medium")
  77. color: UM.Theme.getColor("text")
  78. renderType: Text.NativeRendering
  79. elide: Text.ElideRight
  80. }
  81. Cura.RadioCheckbar
  82. {
  83. anchors
  84. {
  85. left: intentCategoryLabel.right
  86. right: parent.right
  87. }
  88. dataModel: model["qualities"]
  89. buttonGroup: activeProfileButtonGroup
  90. function checkedFunction(modelItem)
  91. {
  92. if(Cura.MachineManager.hasCustomQuality)
  93. {
  94. // When user created profile is active, no quality tickbox should be active.
  95. return false
  96. }
  97. if(modelItem === null)
  98. {
  99. return false
  100. }
  101. return Cura.MachineManager.activeQualityType == modelItem.quality_type && Cura.MachineManager.activeIntentCategory == modelItem.intent_category
  102. }
  103. isCheckedFunction: checkedFunction
  104. }
  105. }
  106. }
  107. }
  108. }