ProfileOverview.qml 1.7 KB

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