PerObjectItem.qml 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. // Copyright (c) 2015 Ultimaker B.V.
  2. // Uranium is released under the terms of the LGPLv3 or higher.
  3. import QtQuick 2.1
  4. import QtQuick.Layouts 1.1
  5. import QtQuick.Controls 2.1
  6. import UM 1.5 as UM
  7. import Cura 1.0 as Cura
  8. UM.TooltipArea
  9. {
  10. x: model.depth * UM.Theme.getSize("default_margin").width
  11. text: model.description
  12. width: childrenRect.width
  13. height: childrenRect.height
  14. Item
  15. {
  16. id: spacer
  17. // Align checkbox with PerObjectCategory icon
  18. width: UM.Theme.getSize("default_margin").width
  19. }
  20. UM.CheckBox
  21. {
  22. id: check
  23. anchors.left: spacer.right
  24. text: definition.label
  25. checked: addedSettingsModel.getVisible(model.key)
  26. onClicked:
  27. {
  28. addedSettingsModel.setVisible(model.key, checked);
  29. UM.ActiveTool.forceUpdate();
  30. }
  31. }
  32. // When the user removes settings from the list addedSettingsModel, we need to recheck if the
  33. // setting is visible or not to show a mark in the CheckBox.
  34. Connections
  35. {
  36. target: addedSettingsModel
  37. function onVisibleCountChanged()
  38. {
  39. check.checked = addedSettingsModel.getVisible(model.key)
  40. }
  41. }
  42. }