RecommendedAdhesionSelector.qml 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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: childrenRect.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. property alias _hovered: adhesionMouseArea.containsMouse
  41. //: Setting enable printing build-plate adhesion helper checkbox
  42. enabled: recommendedPrintSetup.settingsEnabled
  43. visible: platformAdhesionType.properties.enabled == "True"
  44. checked: platformAdhesionType.properties.value != "skirt" && platformAdhesionType.properties.value != "none"
  45. MouseArea
  46. {
  47. id: adhesionMouseArea
  48. anchors.fill: parent
  49. hoverEnabled: true
  50. onClicked:
  51. {
  52. curaRecommendedMode.setAdhesion(!parent.checked)
  53. }
  54. onEntered:
  55. {
  56. base.showTooltip(enableAdhesionCheckBox, Qt.point(-enableAdhesionContainer.x - UM.Theme.getSize("thick_margin").width, 0),
  57. 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."));
  58. }
  59. onExited: base.hideTooltip()
  60. }
  61. }
  62. }
  63. UM.SettingPropertyProvider
  64. {
  65. id: platformAdhesionType
  66. containerStack: Cura.MachineManager.activeMachine
  67. removeUnusedValue: false //Doesn't work with settings that are resolved.
  68. key: "adhesion_type"
  69. watchedProperties: [ "value", "resolve", "enabled" ]
  70. storeIndex: 0
  71. }
  72. }