From 29e152582fbc9f039eb586543147cd71ad732f4e Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Thu, 22 Jun 2017 14:30:26 +0200 Subject: [PATCH 1/2] Make layerview panel hug the bottom of small windows Fixes https://github.com/Ultimaker/Cura/issues/2013 --- resources/qml/Cura.qml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 3addb72bed..d4a6a90b6b 100755 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -306,9 +306,12 @@ UM.MainWindow { id: view_panel - anchors.top: viewModeButton.bottom - anchors.topMargin: UM.Theme.getSize("default_margin").height; + property bool hugBottom: parent.height < viewModeButton.y + viewModeButton.height + height + UM.Theme.getSize("default_margin").height + + anchors.bottom: parent.bottom + anchors.bottomMargin: hugBottom ? 0 : parent.height - (viewModeButton.y + viewModeButton.height + height + UM.Theme.getSize("default_margin").height) anchors.left: viewModeButton.left; + anchors.leftMargin: hugBottom ? viewModeButton.width + UM.Theme.getSize("default_margin").width : 0 height: childrenRect.height; From 48efcdf6e4733b1cae6195c1a3475ab553b0b2b2 Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Thu, 22 Jun 2017 14:59:15 +0200 Subject: [PATCH 2/2] Use a PointingRectangle for the LayerView pane --- plugins/LayerView/LayerView.qml | 10 +++++++++- resources/qml/Cura.qml | 4 +++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/plugins/LayerView/LayerView.qml b/plugins/LayerView/LayerView.qml index 9dc038fe70..46268a784d 100755 --- a/plugins/LayerView/LayerView.qml +++ b/plugins/LayerView/LayerView.qml @@ -11,6 +11,7 @@ import Cura 1.0 as Cura Item { + id: base width: { if (UM.LayerView.compatibilityMode) { return UM.Theme.getSize("layerview_menu_size_compatibility").width; @@ -25,8 +26,12 @@ Item return UM.Theme.getSize("layerview_menu_size").height + UM.LayerView.extruderCount * (UM.Theme.getSize("layerview_row").height + UM.Theme.getSize("layerview_row_spacing").height) } } + property var buttonTarget: { + var force_binding = parent.y; // ensure this gets reevaluated when the panel moves + return base.mapFromItem(parent.parent, parent.buttonTarget.x, parent.buttonTarget.y); + } - Rectangle { + UM.PointingRectangle { id: layerViewMenu anchors.left: parent.left anchors.top: parent.top @@ -35,6 +40,9 @@ Item z: slider.z - 1 color: UM.Theme.getColor("tool_panel_background") + target: parent.buttonTarget + arrowSize: UM.Theme.getSize("default_arrow").width + ColumnLayout { id: view_settings diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index d4a6a90b6b..612ef6b41b 100755 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -308,11 +308,13 @@ UM.MainWindow property bool hugBottom: parent.height < viewModeButton.y + viewModeButton.height + height + UM.Theme.getSize("default_margin").height - anchors.bottom: parent.bottom + anchors.bottom: parent.bottom // panel is always anchored to the bottom only, because dynamically switching between bottom and top results in stretching the height anchors.bottomMargin: hugBottom ? 0 : parent.height - (viewModeButton.y + viewModeButton.height + height + UM.Theme.getSize("default_margin").height) anchors.left: viewModeButton.left; anchors.leftMargin: hugBottom ? viewModeButton.width + UM.Theme.getSize("default_margin").width : 0 + property var buttonTarget: Qt.point(viewModeButton.x + viewModeButton.width / 2, viewModeButton.y + viewModeButton.height / 2) + height: childrenRect.height; source: UM.ActiveView.valid ? UM.ActiveView.activeViewPanel : "";