PerObjectItem.qml 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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 1.1
  6. import QtQuick.Controls.Styles 1.1
  7. import UM 1.2 as UM
  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. CheckBox
  15. {
  16. id: check
  17. text: definition.label
  18. checked: addedSettingsModel.getVisible(model.key)
  19. onClicked:
  20. {
  21. // Important first set visible and then subscribe
  22. // otherwise the setting is not yet in list
  23. // For unsubscribe is important first remove the subscription and then
  24. // set as invisible
  25. if(checked)
  26. {
  27. addedSettingsModel.setVisible(model.key, checked);
  28. UM.ActiveTool.triggerAction("subscribeForSettingValidation", model.key)
  29. }
  30. else
  31. {
  32. UM.ActiveTool.triggerAction("unsubscribeForSettingValidation", model.key)
  33. addedSettingsModel.setVisible(model.key, checked);
  34. }
  35. UM.ActiveTool.forceUpdate();
  36. }
  37. }
  38. }