PrepareMenu.qml 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. import QtQuick 2.7
  2. import QtQuick.Layouts 1.1
  3. import QtQuick.Controls 1.4
  4. import UM 1.3 as UM
  5. import Cura 1.1 as Cura
  6. Item
  7. {
  8. id: prepareMenu
  9. // This widget doesn't show tooltips by itself. Instead it emits signals so others can do something with it.
  10. signal showTooltip(Item item, point location, string text)
  11. signal hideTooltip()
  12. UM.I18nCatalog
  13. {
  14. id: catalog
  15. name: "cura"
  16. }
  17. // Item to ensure that all of the buttons are nicely centered.
  18. Item
  19. {
  20. anchors.horizontalCenter: parent.horizontalCenter
  21. width: openFileButtonBackground.width + itemRowBackground.width
  22. height: parent.height
  23. Rectangle
  24. {
  25. id: openFileButtonBackground
  26. height: UM.Theme.getSize("stage_menu").height
  27. width: UM.Theme.getSize("stage_menu").height
  28. radius: UM.Theme.getSize("default_radius").width
  29. color: UM.Theme.getColor("toolbar_background")
  30. Button
  31. {
  32. id: openFileButton
  33. text: catalog.i18nc("@action:button", "Open File")
  34. iconSource: UM.Theme.getIcon("load")
  35. style: UM.Theme.styles.toolbar_button
  36. tooltip: ""
  37. action: Cura.Actions.open
  38. anchors.centerIn: parent
  39. }
  40. }
  41. Rectangle
  42. {
  43. id: itemRowBackground
  44. radius: UM.Theme.getSize("default_radius").width
  45. color: UM.Theme.getColor("toolbar_background")
  46. width: itemRow.width + UM.Theme.getSize("default_margin").width
  47. height: parent.height
  48. anchors.left: openFileButtonBackground.right
  49. anchors.leftMargin: UM.Theme.getSize("default_margin").width
  50. RowLayout
  51. {
  52. id: itemRow
  53. anchors.centerIn: parent
  54. width: 0.9 * prepareMenu.width
  55. height: parent.height
  56. spacing: 0
  57. Cura.MachineSelector
  58. {
  59. id: machineSelection
  60. z: openFileButton.z - 1
  61. Layout.minimumWidth: 240
  62. Layout.maximumWidth: 240
  63. Layout.fillWidth: true
  64. Layout.fillHeight: true
  65. }
  66. // Separator line
  67. Rectangle
  68. {
  69. height: parent.height
  70. width: UM.Theme.getSize("default_lining").width
  71. color: UM.Theme.getColor("lining")
  72. }
  73. Cura.QuickConfigurationSelector
  74. {
  75. Layout.fillHeight: true
  76. Layout.fillWidth: true
  77. Layout.preferredWidth: itemRow.width - machineSelection.width - printSetupSelector.width - 2 * UM.Theme.getSize("default_lining").width
  78. }
  79. // Separator line
  80. Rectangle
  81. {
  82. height: parent.height
  83. width: UM.Theme.getSize("default_lining").width
  84. color: UM.Theme.getColor("lining")
  85. }
  86. Cura.PrintSetupSelector
  87. {
  88. id: printSetupSelector
  89. onShowTooltip: prepareMenu.showTooltip(item, location, text)
  90. onHideTooltip: prepareMenu.hideTooltip()
  91. Layout.minimumWidth: 460
  92. Layout.maximumWidth: 460
  93. Layout.fillWidth: true
  94. Layout.fillHeight: true
  95. }
  96. }
  97. }
  98. }
  99. }