From bd262ca6c41a09210ca1ad0767d55733a3cea939 Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Thu, 25 Apr 2019 15:37:52 +0200 Subject: [PATCH] Set min.-height and 'stage-awareness' for print-setup-UI. [CURA-6478] --- resources/qml/ExpandableComponent.qml | 17 ++++++++++++++++- .../PrintSetupSelector/PrintSetupSelector.qml | 1 + .../PrintSetupSelectorContents.qml | 14 +++++++++++--- 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/resources/qml/ExpandableComponent.qml b/resources/qml/ExpandableComponent.qml index 0eb27b97b2..b22d19d3e1 100644 --- a/resources/qml/ExpandableComponent.qml +++ b/resources/qml/ExpandableComponent.qml @@ -79,7 +79,10 @@ Item property int shadowOffset: 2 // Prefix used for the dragged position preferences. Preferences not used if empty. Don't translate! - property var dragPreferencesNamePrefix: "" + property string dragPreferencesNamePrefix: "" + + // Whether this component can remain when switchin from one stage to the other (for ex. 'Prepare' to 'Preview') + property bool isMultiStage: false function toggleContent() { @@ -325,6 +328,18 @@ Item updateDragPosition(); } + Connections + { + target: UM.Controller + onActiveStageChanged: + { + if (isMultiStage) + { + updateDragPosition(); + } + } + } + // DO NOT MOVE UP IN THE CODE: This connection has to be here, after the definition of the content item. // Apparently the order in which these are handled matters and so the height is correctly updated if this is here. Connections diff --git a/resources/qml/PrintSetupSelector/PrintSetupSelector.qml b/resources/qml/PrintSetupSelector/PrintSetupSelector.qml index 1a9bd9f109..5b22ed3393 100644 --- a/resources/qml/PrintSetupSelector/PrintSetupSelector.qml +++ b/resources/qml/PrintSetupSelector/PrintSetupSelector.qml @@ -12,6 +12,7 @@ Cura.ExpandableComponent id: printSetupSelector dragPreferencesNamePrefix: "view/settings" + isMultiStage: true property bool preSlicedData: PrintInformation.preSliced diff --git a/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml b/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml index 99dca6764b..3b090f7476 100644 --- a/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml +++ b/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml @@ -14,6 +14,8 @@ Item { id: content + property int absoluteMinimumHeight: 200 * screenScaleFactor + width: UM.Theme.getSize("print_setup_widget").width - 2 * UM.Theme.getSize("default_margin").width height: contents.height + buttonRow.height @@ -86,8 +88,14 @@ Item Math.min ( UM.Preferences.getValue("view/settings_list_height"), - base.height - (customPrintSetup.mapToItem(null, 0, 0).y + buttonRow.height + UM.Theme.getSize("default_margin").height) + Math.max + ( + absoluteMinimumHeight, + base.height - (customPrintSetup.mapToItem(null, 0, 0).y + buttonRow.height + UM.Theme.getSize("default_margin").height) + ) ); + + updateDragPosition(); } } visible: currentModeIndex == PrintSetupSelectorContents.Mode.Custom @@ -175,9 +183,9 @@ Item // position of mouse relative to dropdown align vertical centre of mouse area to cursor // v------------------------------v v------------v var h = mouseY + buttonRow.y + content.y - height / 2 | 0; - if(h < 200 * screenScaleFactor) //Enforce a minimum size. + if(h < absoluteMinimumHeight) //Enforce a minimum size. { - h = 200 * screenScaleFactor; + h = absoluteMinimumHeight; } //Absolute mouse Y position in the window, to prevent it from going outside the window.