Browse Source

Set min.-height and 'stage-awareness' for print-setup-UI. [CURA-6478]

Remco Burema 5 years ago
parent
commit
bd262ca6c4

+ 16 - 1
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

+ 1 - 0
resources/qml/PrintSetupSelector/PrintSetupSelector.qml

@@ -12,6 +12,7 @@ Cura.ExpandableComponent
     id: printSetupSelector
 
     dragPreferencesNamePrefix: "view/settings"
+    isMultiStage: true
 
     property bool preSlicedData: PrintInformation.preSliced
 

+ 11 - 3
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.