RecommendedAdhesionSelector.qml 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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("category_adhesion")
  23. text: catalog.i18nc("@label", "Adhesion")
  24. font: UM.Theme.getFont("medium")
  25. width: labelColumnWidth
  26. }
  27. Item
  28. {
  29. id: enableAdhesionContainer
  30. height: enableAdhesionCheckBox.height
  31. anchors
  32. {
  33. left: enableAdhesionRowTitle.right
  34. right: parent.right
  35. verticalCenter: enableAdhesionRowTitle.verticalCenter
  36. }
  37. CheckBox
  38. {
  39. id: enableAdhesionCheckBox
  40. anchors.verticalCenter: parent.verticalCenter
  41. property alias _hovered: adhesionMouseArea.containsMouse
  42. //: Setting enable printing build-plate adhesion helper checkbox
  43. style: UM.Theme.styles.checkbox
  44. enabled: recommendedPrintSetup.settingsEnabled
  45. visible: platformAdhesionType.properties.enabled == "True"
  46. checked: platformAdhesionType.properties.value != "skirt" && platformAdhesionType.properties.value != "none"
  47. MouseArea
  48. {
  49. id: adhesionMouseArea
  50. anchors.fill: parent
  51. hoverEnabled: true
  52. onClicked:
  53. {
  54. curaRecommendedMode.setAdhesion(!parent.checked)
  55. }
  56. onEntered:
  57. {
  58. base.showTooltip(enableAdhesionCheckBox, Qt.point(-enableAdhesionContainer.x - UM.Theme.getSize("thick_margin").width, 0),
  59. 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."));
  60. }
  61. onExited: base.hideTooltip()
  62. }
  63. }
  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. }