mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-15 10:47:49 -06:00
Hide action panel when displaying a stage with a background
This is not the worst hack ever, but it's quite a hack. Contributes to issue CURA-6054.
This commit is contained in:
parent
6eca0ce69f
commit
798c1f198c
2 changed files with 51 additions and 23 deletions
|
@ -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 2.10
|
||||||
import QtQuick.Controls 1.4
|
import QtQuick.Controls 1.4
|
||||||
|
@ -7,31 +8,27 @@ import UM 1.3 as UM
|
||||||
import Cura 1.0 as Cura
|
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
|
id: viewportOverlay
|
||||||
Rectangle
|
|
||||||
|
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
|
anchors.fill: parent
|
||||||
|
acceptedButtons: Qt.AllButtons
|
||||||
// This mouse area is to prevent mouse clicks to be passed onto the scene.
|
onWheel: wheel.accepted = true
|
||||||
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
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Disable dropping files into Cura when the monitor page is active
|
||||||
|
DropArea
|
||||||
|
{
|
||||||
|
anchors.fill: parent
|
||||||
|
}
|
||||||
Loader
|
Loader
|
||||||
{
|
{
|
||||||
id: monitorViewComponent
|
id: monitorViewComponent
|
||||||
|
|
|
@ -252,7 +252,21 @@ UM.MainWindow
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
anchors.rightMargin: UM.Theme.getSize("thick_margin").width
|
anchors.rightMargin: UM.Theme.getSize("thick_margin").width
|
||||||
anchors.bottomMargin: UM.Theme.getSize("thick_margin").height
|
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
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue