RecommendedAdhesionSelector.qml 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. // Copyright (c) 2018 Ultimaker B.V.
  2. // Cura is released under the terms of the LGPLv3 or higher.
  3. import QtQuick 2.7
  4. import UM 1.5 as UM
  5. import Cura 1.0 as Cura
  6. //
  7. // Adhesion
  8. //
  9. Item
  10. {
  11. id: enableAdhesionRow
  12. height: enableAdhesionContainer.height
  13. property real labelColumnWidth: Math.round(width / 3)
  14. property var curaRecommendedMode: Cura.RecommendedMode {}
  15. Cura.IconWithText
  16. {
  17. id: enableAdhesionRowTitle
  18. anchors.top: parent.top
  19. anchors.left: parent.left
  20. source: UM.Theme.getIcon("Adhesion")
  21. text: catalog.i18nc("@label", "Adhesion")
  22. font: UM.Theme.getFont("medium")
  23. width: labelColumnWidth
  24. iconSize: UM.Theme.getSize("medium_button_icon").width
  25. }
  26. Item
  27. {
  28. id: enableAdhesionContainer
  29. height: enableAdhesionCheckBox.height
  30. anchors
  31. {
  32. left: enableAdhesionRowTitle.right
  33. right: parent.right
  34. verticalCenter: enableAdhesionRowTitle.verticalCenter
  35. }
  36. UM.CheckBox
  37. {
  38. id: enableAdhesionCheckBox
  39. anchors.verticalCenter: parent.verticalCenter
  40. //: Setting enable printing build-plate adhesion helper checkbox
  41. enabled: recommendedPrintSetup.settingsEnabled
  42. visible: platformAdhesionType.properties.enabled == "True"
  43. checked: platformAdhesionType.properties.value != "skirt" && platformAdhesionType.properties.value != "none"
  44. MouseArea
  45. {
  46. id: adhesionMouseArea
  47. anchors.fill: parent
  48. hoverEnabled: true
  49. // propagateComposedEvents used on adhesionTooltipMouseArea does not work with Controls Components.
  50. // It only works with other MouseAreas, so this is required
  51. onClicked: curaRecommendedMode.setAdhesion(!parent.checked)
  52. }
  53. }
  54. }
  55. MouseArea
  56. {
  57. id: adhesionTooltipMouseArea
  58. anchors.fill: parent
  59. propagateComposedEvents: true
  60. hoverEnabled: true
  61. onEntered:base.showTooltip(enableAdhesionCheckBox, Qt.point(-enableAdhesionContainer.x - UM.Theme.getSize("thick_margin").width, 0),
  62. catalog.i18nc("@label", "Enable printing a brim or raft. This will add a flat area around or under your object which is easy to cut off afterwards."));
  63. onExited: base.hideTooltip()
  64. }
  65. UM.SettingPropertyProvider
  66. {
  67. id: platformAdhesionType
  68. containerStack: Cura.MachineManager.activeMachine
  69. removeUnusedValue: false //Doesn't work with settings that are resolved.
  70. key: "adhesion_type"
  71. watchedProperties: [ "value", "resolve", "enabled" ]
  72. storeIndex: 0
  73. }
  74. }