RecommendedSettingSection.qml 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. // Copyright (c) 2022 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 2.10
  6. import UM 1.6 as UM
  7. import Cura 1.7 as Cura
  8. Item
  9. {
  10. property alias title: sectionTitle.text
  11. property alias icon: sectionTitle.source
  12. property Component content: Item { visible: false }
  13. property alias enableSectionVisible: enableSectionSwitch.visible
  14. property alias enableSectionChecked: enableSectionSwitch.checked
  15. property alias enableSectionEnabled: enableSectionSwitch.enabled
  16. property var enableSectionClicked: { return }
  17. property int leftColumnWidth: width / 2
  18. property alias contents: settingColumn.children
  19. function onEnableSectionChanged(state) {}
  20. height: childrenRect.height
  21. Item
  22. {
  23. id: sectionHeader
  24. anchors.top: parent.top
  25. anchors.right: parent.right
  26. anchors.left: parent.left
  27. height: UM.Theme.getSize("section_header").height
  28. Cura.IconWithText
  29. {
  30. id: sectionTitle
  31. width: leftColumnWidth
  32. anchors.left: parent.left
  33. anchors.verticalCenter: parent.verticalCenter
  34. anchors.leftMargin: - UM.Theme.getSize("thick_lining").width
  35. source: UM.Theme.getIcon("PrintQuality")
  36. spacing: UM.Theme.getSize("thick_margin").width
  37. iconSize: UM.Theme.getSize("medium_button_icon").width
  38. iconColor: UM.Theme.getColor("text")
  39. font: UM.Theme.getFont("medium_bold")
  40. }
  41. UM.Switch
  42. {
  43. id: enableSectionSwitch
  44. anchors.left: sectionTitle.right
  45. anchors.verticalCenter: parent.verticalCenter
  46. visible: false
  47. onClicked: onEnableSectionChanged(enableSectionSwitch.checked)
  48. }
  49. MouseArea
  50. {
  51. id: tooltipMouseArea
  52. anchors.fill: parent
  53. propagateComposedEvents: true
  54. hoverEnabled: true
  55. onEntered: { print("showTooltip") }
  56. onExited: { print("hideTooltip" ) }
  57. }
  58. }
  59. Loader
  60. {
  61. id: contentLoader
  62. width: parent.width
  63. height: childrenRect.height
  64. anchors.left: parent.left
  65. anchors.right: parent.right
  66. anchors.verticalCenter: parent.verticalCenter
  67. sourceComponent: content
  68. }
  69. }