PreviewMain.qml 1.4 KB

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