PreviewMain.qml 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // Copyright (c) 2021 Ultimaker B.V.
  2. // Cura is released under the terms of the LGPLv3 or higher.
  3. import QtQuick 2.4
  4. import UM 1.0 as UM
  5. import Cura 1.0 as Cura
  6. Item
  7. {
  8. // An Item whose bounds are guaranteed to be safe for overlays to be placed.
  9. // Defaults to parent, ie. the entire available area
  10. property var safeArea: parent
  11. // Subtract the actionPanel from the safe area. This way the view won't draw interface elements under/over it
  12. Item
  13. {
  14. id: childSafeArea
  15. x: safeArea.x - parent.x
  16. y: safeArea.y - parent.y
  17. width: actionPanelWidget.x - x
  18. height: actionPanelWidget.y - y
  19. }
  20. Loader
  21. {
  22. id: previewMain
  23. anchors.fill: parent
  24. source: UM.Controller.activeView != null && UM.Controller.activeView.mainComponent != null ? UM.Controller.activeView.mainComponent : ""
  25. onLoaded:
  26. {
  27. if (previewMain.item.safeArea !== undefined){
  28. previewMain.item.safeArea = Qt.binding(function() { return childSafeArea });
  29. }
  30. }
  31. }
  32. Cura.ActionPanelWidget
  33. {
  34. id: actionPanelWidget
  35. anchors.right: parent.right
  36. anchors.bottom: parent.bottom
  37. anchors.rightMargin: UM.Theme.getSize("thick_margin").width
  38. anchors.bottomMargin: UM.Theme.getSize("thick_margin").height
  39. hasPreviewButton: false
  40. }
  41. }