ProfileOverview.qml 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. //Copyright (c) 2022 Ultimaker B.V.
  2. //Cura is released under the terms of the LGPLv3 or higher.
  3. import QtQuick 2.7
  4. import QtQuick.Controls 2.15
  5. import UM 1.6 as UM
  6. import Cura 1.6 as Cura
  7. Cura.TableView
  8. {
  9. id: profileOverview
  10. property var qualityItem //The quality profile to display here.
  11. property int extruderPosition: -1 //The extruder to display. -1 denotes the global stack.
  12. property bool isQualityItemCurrentlyActivated: qualityItem != null && qualityItem.name == Cura.MachineManager.activeQualityOrQualityChangesName
  13. // Hack to make sure that when the data of our model changes the tablemodel is also updated
  14. // If we directly set the rows (So without the clear being called) it doesn't seem to
  15. // get updated correctly.
  16. property var modelRows: qualitySettings.items
  17. onModelRowsChanged:
  18. {
  19. tableModel.clear()
  20. tableModel.rows = modelRows
  21. }
  22. Cura.QualitySettingsModel
  23. {
  24. id: qualitySettings
  25. selectedPosition: profileOverview.extruderPosition
  26. selectedQualityItem: profileOverview.qualityItem == null ? {} : profileOverview.qualityItem
  27. }
  28. columnHeaders: [
  29. catalog.i18nc("@title:column", "Setting"),
  30. catalog.i18nc("@title:column", "Profile"),
  31. catalog.i18nc("@title:column", "Current"),
  32. catalog.i18nc("@title:column Unit of measurement", "Unit")
  33. ]
  34. model: UM.TableModel
  35. {
  36. id: tableModel
  37. headers: ["label", "profile_value", "user_value", "unit"]
  38. rows: modelRows
  39. }
  40. sectionRole: "category"
  41. }