SimpleCheckBox.qml 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. // Copyright (c) 2019 Ultimaker B.V.
  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 1.3
  6. import UM 1.3 as UM
  7. import Cura 1.1 as Cura
  8. //
  9. // CheckBox widget for the on/off or true/false settings in the Machine Settings Dialog.
  10. //
  11. UM.TooltipArea
  12. {
  13. UM.I18nCatalog { id: catalog; name: "cura"; }
  14. height: childrenRect.height
  15. width: childrenRect.width
  16. text: tooltip
  17. property alias containerStackId: propertyProvider.containerStackId
  18. property alias settingKey: propertyProvider.key
  19. property alias settingStoreIndex: propertyProvider.storeIndex
  20. property alias labelText: checkBox.text
  21. property string tooltip: propertyProvider.properties.description
  22. // callback functions
  23. property var forceUpdateOnChangeFunction: dummy_func
  24. // a dummy function for default property values
  25. function dummy_func() {}
  26. UM.SettingPropertyProvider
  27. {
  28. id: propertyProvider
  29. watchedProperties: [ "value", "description" ]
  30. }
  31. CheckBox
  32. {
  33. id: checkBox
  34. checked: String(propertyProvider.properties.value).toLowerCase() != 'false'
  35. onClicked:
  36. {
  37. propertyProvider.setPropertyValue("value", checked)
  38. forceUpdateOnChangeFunction()
  39. }
  40. }
  41. }