diff --git a/plugins/MonitorStage/MonitorMain.qml b/plugins/MonitorStage/MonitorMain.qml index 34cf4ad801..5fda32db9e 100644 --- a/plugins/MonitorStage/MonitorMain.qml +++ b/plugins/MonitorStage/MonitorMain.qml @@ -1,4 +1,5 @@ -// Copyright (c) 2017 Ultimaker B.V. +// Copyright (c) 2018 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.10 import QtQuick.Controls 1.4 @@ -7,31 +8,27 @@ import UM 1.3 as UM import Cura 1.0 as Cura -Item +// 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 + + color: UM.Theme.getColor("viewport_overlay") + anchors.fill: parent + + // This mouse area is to prevent mouse clicks to be passed onto the scene. + MouseArea { - id: viewportOverlay - - color: UM.Theme.getColor("viewport_overlay") anchors.fill: parent - - // This mouse area is to prevent mouse clicks to be passed onto the scene. - MouseArea - { - anchors.fill: parent - acceptedButtons: Qt.AllButtons - onWheel: wheel.accepted = true - } - - // Disable dropping files into Cura when the monitor page is active - DropArea - { - anchors.fill: parent - } + acceptedButtons: Qt.AllButtons + onWheel: wheel.accepted = true } + // Disable dropping files into Cura when the monitor page is active + DropArea + { + anchors.fill: parent + } Loader { id: monitorViewComponent @@ -45,4 +42,4 @@ Item sourceComponent: Cura.MachineManager.printerOutputDevices.length > 0 ? Cura.MachineManager.printerOutputDevices[0].monitorItem : null } -} +} \ No newline at end of file diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 8a34c7e219..a78295e7fa 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -252,7 +252,21 @@ UM.MainWindow anchors.bottom: parent.bottom anchors.rightMargin: UM.Theme.getSize("thick_margin").width anchors.bottomMargin: UM.Theme.getSize("thick_margin").height - visible: CuraApplication.platformActivity + + /* + Show this panel only if there is something on the build plate, and there is NOT an opaque item in front of the build plate. + This cannot be solved by Z indexing! If you want to try solving this, please increase this counter when you're done: + Number of people having tried to fix this by z-indexing: 2 + The problem arises from the following render order requirements: + - The stage menu must be rendered above the stage main. + - The stage main must be rendered above the action panel (because the monitor page must be rendered above the action panel). + - The action panel must be rendered above the expandable components drop-down. + However since the expandable components drop-downs are child elements of the stage menu, + they can't be rendered lower than elements that are lower than the stage menu. + Therefore we opted to forego the second requirement and hide the action panel instead when something obscures it (except the expandable components). + We assume that QQuickRectangles are always opaque and any other item is not. + */ + visible: CuraApplication.platformActivity && (main.item == null || !qmlTypeOf(main.item, "QQuickRectangle")) } Loader @@ -818,4 +832,21 @@ UM.MainWindow } } } + + /** + * Function to check whether a QML object has a certain type. + * Taken from StackOverflow: https://stackoverflow.com/a/28384228 and + * adapted to our code style. + * Licensed under CC BY-SA 3.0. + * \param obj The QtObject to get the name of. + * \param class_name (str) The name of the class to check against. Has to be + * the QtObject class name, not the QML entity name. + */ + function qmlTypeOf(obj, class_name) + { + //className plus "(" is the class instance without modification. + //className plus "_QML" is the class instance with user-defined properties. + var str = obj.toString(); + return str.indexOf(class_name + "(") == 0 || str.indexOf(class_name + "_QML") == 0; + } }