RecommendedQualityProfileSelector.qml 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. // Copyright (c) 2023 UltiMaker
  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 ? model.icon : ""
  27. custom_icon: model.custom_icon ? model.custom_icon : ""
  28. tooltipText: model.description ? model.description : ""
  29. selected: Cura.MachineManager.activeIntentCategory == model.intent_category
  30. onClicked: {
  31. var qualityType
  32. if (Cura.MachineManager.intentCategoryHasQuality(model.intent_category, Cura.MachineManager.activeQualityType))
  33. {
  34. qualityType = Cura.MachineManager.activeQualityType
  35. } else {
  36. qualityType = Cura.MachineManager.getDefaultQualityTypeForIntent(model.intent_category)
  37. }
  38. Cura.IntentManager.selectIntent(model.intent_category, qualityType)
  39. }
  40. }
  41. }
  42. }
  43. }