Browse Source

Fix setting text fields overlapping in per-object-settings

CURA-10669
c.lamboo 1 year ago
parent
commit
eca903430e

+ 23 - 68
plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml

@@ -167,11 +167,7 @@ Item
 
             onActivated:
             {
-                if (index == 0){
-                    setMeshType(infillMeshType)
-                } else {
-                    setMeshType(cuttingMeshType)
-                }
+                setMeshType(index === 0 ? infillMeshType : cuttingMeshType);
             }
 
             Binding
@@ -204,21 +200,21 @@ Item
                 model: UM.SettingDefinitionsModel
                 {
                     id: addedSettingsModel
-                    containerId: Cura.MachineManager.activeMachine != null ? Cura.MachineManager.activeMachine.definition.id: ""
-                    expanded: [ "*" ]
+                    containerId: Cura.MachineManager.activeMachine !== null ? Cura.MachineManager.activeMachine.definition.id: ""
+                    expanded: ["*"]
                     filter:
                     {
-                        if (printSequencePropertyProvider.properties.value == "one_at_a_time")
+                        if (printSequencePropertyProvider.properties.value === "one_at_a_time")
                         {
-                            return {"settable_per_meshgroup": true}
+                            return { settable_per_meshgroup: true }
                         }
-                        return {"settable_per_mesh": true}
+                        return { settable_per_meshgroup: true }
                     }
                     exclude:
                     {
-                        var excluded_settings = [ "support_mesh", "anti_overhang_mesh", "cutting_mesh", "infill_mesh" ]
+                        const excluded_settings = ["support_mesh", "anti_overhang_mesh", "cutting_mesh", "infill_mesh"]
 
-                        if (currentMeshType == "support_mesh")
+                        if (currentMeshType === "support_mesh")
                         {
                             excluded_settings = excluded_settings.concat(base.allCategoriesExceptSupport)
                         }
@@ -246,7 +242,6 @@ Item
                     {
                         id: settingLoader
                         width: UM.Theme.getSize("setting").width - removeButton.width - scrollBar.width
-                        height: UM.Theme.getSize("section").height + UM.Theme.getSize("narrow_margin").height
                         enabled: provider.properties.enabled === "True"
                         property var definition: model
                         property var settingDefinitionsModel: addedSettingsModel
@@ -257,7 +252,7 @@ Item
                         //Qt5.4.2 and earlier has a bug where this causes a crash: https://bugreports.qt.io/browse/QTBUG-35989
                         //In addition, while it works for 5.5 and higher, the ordering of the actual combo box drop down changes,
                         //causing nasty issues when selecting different options. So disable asynchronous loading of enum type completely.
-                        asynchronous: model.type != "enum" && model.type != "extruder"
+                        asynchronous: model.type !== "enum" && model.type !== "extruder"
 
                         onLoaded:
                         {
@@ -266,6 +261,7 @@ Item
                             settingLoader.item.showLinkedSettingIcon = false
                             settingLoader.item.doDepthIndentation = false
                             settingLoader.item.doQualityUserSettingEmphasis = false
+                            settingLoader.item.height = UM.Theme.getSize("setting").height + UM.Theme.getSize("narrow_margin").height
                         }
 
                         sourceComponent:
@@ -362,11 +358,11 @@ Item
                             if (typeof UM.ActiveTool.properties.getValue("ContainerID") !== "undefined")
                             {
                                 const containerId = UM.ActiveTool.properties.getValue("ContainerID")
-                                if (provider.containerStackId != containerId)
+                                if (provider.containerStackId !== containerId)
                                 {
                                     provider.containerStackId = containerId
                                 }
-                                if (inheritStackProvider.containerStackId != containerId)
+                                if (inheritStackProvider.containerStackId !== containerId)
                                 {
                                     inheritStackProvider.containerStackId = containerId
                                 }
@@ -388,13 +384,13 @@ Item
             onClicked:
             {
                 settingPickDialog.visible = true;
-                if (currentMeshType == "support_mesh")
+                if (currentMeshType === "support_mesh")
                 {
                     settingPickDialog.additional_excluded_settings = base.allCategoriesExceptSupport;
                 }
                 else
                 {
-                    settingPickDialog.additional_excluded_settings = []
+                    settingPickDialog.additional_excluded_settings = [];
                 }
             }
         }
@@ -412,7 +408,7 @@ Item
 
         containerStack: Cura.MachineManager.activeMachine
         key: "machine_extruder_count"
-        watchedProperties: [ "value" ]
+        watchedProperties: ["value"]
         storeIndex: 0
     }
 
@@ -422,56 +418,15 @@ Item
 
         containerStack: Cura.MachineManager.activeMachine
         key: "print_sequence"
-        watchedProperties: [ "value" ]
+        watchedProperties: ["value"]
         storeIndex: 0
     }
 
-    Component
-    {
-        id: settingTextField
-
-        Cura.SettingTextField { }
-    }
-
-    Component
-    {
-        id: settingComboBox
-
-        Cura.SettingComboBox { }
-    }
-
-    Component
-    {
-        id: settingExtruder
-
-        Cura.SettingExtruder { }
-    }
-
-    Component
-    {
-        id: settingOptionalExtruder
-
-        Cura.SettingOptionalExtruder { }
-    }
-
-    Component
-    {
-        id: settingCheckBox
-
-        Cura.SettingCheckBox { }
-    }
-
-    Component
-    {
-        id: settingCategory
-
-        Cura.SettingCategory { }
-    }
-
-    Component
-    {
-        id: settingUnknown
-
-        Cura.SettingUnknown { }
-    }
+    Component { id: settingTextField; Cura.SettingTextField { } }
+    Component { id: settingComboBox; Cura.SettingComboBox { } }
+    Component { id: settingExtruder; Cura.SettingExtruder { } }
+    Component { id: settingOptionalExtruder; Cura.SettingOptionalExtruder { } }
+    Component { id: settingCheckBox; Cura.SettingCheckBox { } }
+    Component { id: settingCategory; Cura.SettingCategory { } }
+    Component { id: settingUnknown; Cura.SettingUnknown { } }
 }

+ 1 - 1
resources/qml/Settings/SettingItem.qml

@@ -13,7 +13,7 @@ import "."
 Item
 {
     id: base
-    height: visible ? UM.Theme.getSize("section").height + UM.Theme.getSize("narrow_margin").height : 0
+    height: enabled ? UM.Theme.getSize("section").height + UM.Theme.getSize("narrow_margin").height : 0
     anchors.left: parent.left
     anchors.right: parent.right