Fix MonitorMainView for USB printing

CURA-5943
This commit is contained in:
Lipu Fei 2018-11-22 15:07:49 +01:00
parent d8c3078d78
commit 2d2f24251d

View File

@ -1,45 +1,61 @@
// Copyright (c) 2017 Ultimaker B.V. // Copyright (c) 2017 Ultimaker B.V.
import QtQuick 2.2 import QtQuick 2.10
import QtQuick.Controls 1.1 import QtQuick.Controls 1.4
import UM 1.3 as UM import UM 1.3 as UM
import Cura 1.0 as Cura import Cura 1.0 as Cura
Item
{ Item
// parent could be undefined as this component is not visible at all times {
width: parent ? parent.width : 0 // parent could be undefined as this component is not visible at all times
height: parent ? parent.height : 0 width: parent ? parent.width : 0
height: parent ? parent.height : 0
// We show a nice overlay on the 3D viewer when the current output device has no monitor view
Rectangle // We show a nice overlay on the 3D viewer when the current output device has no monitor view
{ Rectangle
id: viewportOverlay {
id: viewportOverlay
color: UM.Theme.getColor("viewport_overlay")
width: parent.width color: UM.Theme.getColor("viewport_overlay")
height: parent.height width: parent.width
height: parent.height
MouseArea
{ MouseArea
anchors.fill: parent {
acceptedButtons: Qt.AllButtons anchors.fill: parent
onWheel: wheel.accepted = true acceptedButtons: Qt.AllButtons
} onWheel: wheel.accepted = true
} }
}
Loader
{ Loader
id: monitorViewComponent {
id: monitorViewComponent
width: parent.width
height: parent.height anchors.top: parent.top
anchors.bottom: parent.bottom
property real maximumWidth: parent.width anchors.left: parent.left
property real maximumHeight: parent.height
width: parent.width * 0.7
sourceComponent: Cura.MachineManager.printerOutputDevices.length > 0 ? Cura.MachineManager.printerOutputDevices[0].monitorItem: null height: parent.height
visible: sourceComponent != null
} property real maximumWidth: parent.width
} property real maximumHeight: parent.height
sourceComponent: Cura.MachineManager.printerOutputDevices.length > 0 ? Cura.MachineManager.printerOutputDevices[0].monitorItem: null
}
Loader
{
id: monitorSidebarComponent
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.left: monitorViewComponent.right
anchors.right: parent.right
source: UM.Controller.activeStage.sidebarComponent != null ? UM.Controller.activeStage.sidebarComponent : ""
}
}