RecommendedQualityProfileSelector.qml 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. // Copyright (c) 2022 Ultimaker B.V.
  2. // Cura is released under the terms of the LGPLv3 or higher.
  3. import QtQuick 2.10
  4. import QtQuick.Controls 2.3
  5. import QtQuick.Layouts 2.10
  6. import UM 1.5 as UM
  7. import Cura 1.7 as Cura
  8. import ".."
  9. Item
  10. {
  11. id: qualityRow
  12. property bool hasQualityOptions: true
  13. height: childrenRect.height
  14. visible: intentSelectionRepeater.count > 1 && hasQualityOptions //Only show selector if there's more options than just "default".
  15. RowLayout
  16. {
  17. id: intentRow
  18. width: parent.width
  19. Repeater
  20. {
  21. id: intentSelectionRepeater
  22. model: Cura.IntentSelectionModel {}
  23. RecommendedQualityProfileSelectorButton
  24. {
  25. profileName: model.name
  26. icon: model.icon
  27. selected: Cura.MachineManager.activeIntentCategory == model.intent_category
  28. onClicked: {
  29. var qualityType
  30. if (Cura.MachineManager.intentCategoryHasQuality(model.intent_category, Cura.MachineManager.activeQualityType))
  31. {
  32. qualityType = Cura.MachineManager.activeQualityType
  33. } else {
  34. qualityType = Cura.MachineManager.getDefaultQualityTypeForIntent(model.intent_category)
  35. }
  36. Cura.IntentManager.selectIntent(model.intent_category, qualityType)
  37. }
  38. }
  39. }
  40. }
  41. }