RecommendedAdhesionSelector.qml 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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 QtQuick.Controls 1.4
  5. import QtQuick.Controls.Styles 1.4
  6. import UM 1.2 as UM
  7. import Cura 1.0 as Cura
  8. //
  9. // Adhesion
  10. //
  11. Item
  12. {
  13. id: enableAdhesionRow
  14. height: childrenRect.height
  15. property real labelColumnWidth: Math.round(width / 3)
  16. property var curaRecommendedMode: Cura.RecommendedMode {}
  17. Cura.IconWithText
  18. {
  19. id: enableAdhesionRowTitle
  20. anchors.top: parent.top
  21. anchors.left: parent.left
  22. source: UM.Theme.getIcon("Adhesion")
  23. text: catalog.i18nc("@label", "Adhesion")
  24. font: UM.Theme.getFont("medium")
  25. width: labelColumnWidth
  26. iconSize: UM.Theme.getSize("medium_button_icon").width
  27. }
  28. Item
  29. {
  30. id: enableAdhesionContainer
  31. height: enableAdhesionCheckBox.height
  32. anchors
  33. {
  34. left: enableAdhesionRowTitle.right
  35. right: parent.right
  36. verticalCenter: enableAdhesionRowTitle.verticalCenter
  37. }
  38. CheckBox
  39. {
  40. id: enableAdhesionCheckBox
  41. anchors.verticalCenter: parent.verticalCenter
  42. property alias _hovered: adhesionMouseArea.containsMouse
  43. //: Setting enable printing build-plate adhesion helper checkbox
  44. style: UM.Theme.styles.checkbox
  45. enabled: recommendedPrintSetup.settingsEnabled
  46. visible: platformAdhesionType.properties.enabled == "True"
  47. checked: platformAdhesionType.properties.value != "skirt" && platformAdhesionType.properties.value != "none"
  48. MouseArea
  49. {
  50. id: adhesionMouseArea
  51. anchors.fill: parent
  52. hoverEnabled: true
  53. onClicked:
  54. {
  55. curaRecommendedMode.setAdhesion(!parent.checked)
  56. }
  57. onEntered:
  58. {
  59. base.showTooltip(enableAdhesionCheckBox, Qt.point(-enableAdhesionContainer.x - UM.Theme.getSize("thick_margin").width, 0),
  60. 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."));
  61. }
  62. onExited: base.hideTooltip()
  63. }
  64. }
  65. }
  66. UM.SettingPropertyProvider
  67. {
  68. id: platformAdhesionType
  69. containerStack: Cura.MachineManager.activeMachine
  70. removeUnusedValue: false //Doesn't work with settings that are resolved.
  71. key: "adhesion_type"
  72. watchedProperties: [ "value", "resolve", "enabled" ]
  73. storeIndex: 0
  74. }
  75. }