Browse Source

Scale instead of center for preview/prepare-menus. [CURA-6478]

Remco Burema 5 years ago
parent
commit
c4265c1f67

+ 10 - 2
plugins/PrepareStage/PrepareMenu.qml

@@ -20,11 +20,19 @@ Item
         name: "cura"
     }
 
+    anchors
+    {
+        left: parent.left
+        right: parent.right
+        leftMargin: UM.Theme.getSize("wide_margin").width
+        rightMargin: UM.Theme.getSize("wide_margin").width
+    }
+
     // Item to ensure that all of the buttons are nicely centered.
     Item
     {
         anchors.horizontalCenter: parent.horizontalCenter
-        width: openFileButton.width + itemRow.width + UM.Theme.getSize("default_margin").width
+        width: parent.width - 2 * UM.Theme.getSize("wide_margin").width
         height: parent.height
 
         RowLayout
@@ -32,9 +40,9 @@ Item
             id: itemRow
 
             anchors.left: openFileButton.right
+            anchors.right: parent.right
             anchors.leftMargin: UM.Theme.getSize("default_margin").width
 
-            width: Math.round(0.9 * prepareMenu.width)
             height: parent.height
             spacing: 0
 

+ 15 - 6
plugins/PreviewStage/PreviewMenu.qml

@@ -20,15 +20,24 @@ Item
         name: "cura"
     }
 
+    anchors
+    {
+        left: parent.left
+        right: parent.right
+        leftMargin: UM.Theme.getSize("wide_margin").width
+        rightMargin: UM.Theme.getSize("wide_margin").width
+    }
+
     Row
     {
         id: stageMenuRow
-        anchors.centerIn: parent
+
+        anchors.horizontalCenter: parent.horizontalCenter
+        width: parent.width - 2 * UM.Theme.getSize("wide_margin").width
         height: parent.height
-        width: childrenRect.width
 
-        // We want this row to have a preferred with equals to the 85% of the parent
-        property int preferredWidth: Math.round(0.85 * previewMenu.width)
+        // // We want this row to have a preferred with up to the 85% of the parent
+        // property int preferredWidth: Math.round(0.85 * previewMenu.width)
 
         Cura.ViewsSelector
         {
@@ -49,12 +58,12 @@ Item
             color: UM.Theme.getColor("lining")
         }
 
-        // This component will grow freely up to complete the preferredWidth of the row.
+        // This component will grow freely up to complete the width of the row.
         Loader
         {
             id: viewPanel
             height: parent.height
-            width: source != "" ? (stageMenuRow.preferredWidth - viewsSelector.width - printSetupSelectorItem.width - 2 * UM.Theme.getSize("default_lining").width) : 0
+            width: source != "" ? (previewMenu.width - viewsSelector.width - printSetupSelectorItem.width - 2 * (UM.Theme.getSize("wide_margin").width + UM.Theme.getSize("default_lining").width)) : 0
             source: UM.Controller.activeView != null && UM.Controller.activeView.stageMenuComponent != null ? UM.Controller.activeView.stageMenuComponent : ""
         }
 

+ 0 - 15
resources/qml/ExpandableComponent.qml

@@ -81,9 +81,6 @@ Item
     // Prefix used for the dragged position preferences. Preferences not used if empty. Don't translate!
     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()
     {
         contentContainer.visible = !expanded
@@ -328,18 +325,6 @@ 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

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

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