Browse Source

Prevent showing custom profiles twice and fix separator in the profiles dropdown

CURA-1887
fieldOfView 8 years ago
parent
commit
4aa95ab317
1 changed files with 16 additions and 7 deletions
  1. 16 7
      resources/qml/Menus/ProfileMenu.qml

+ 16 - 7
resources/qml/Menus/ProfileMenu.qml

@@ -13,7 +13,10 @@ import Cura 1.0 as Cura
 
     Instantiator
     {
-        model: UM.InstanceContainersModel { filter: menu.getFilter({ "read_only": true }); }
+        model: UM.InstanceContainersModel
+        {
+            filter: menu.getFilter({ "read_only": true });
+        }
 
         MenuItem
         {
@@ -32,13 +35,11 @@ import Cura 1.0 as Cura
 
     Instantiator
     {
+        id: customProfileInstantiator
         model: UM.InstanceContainersModel
         {
-            id: customProfilesModel;
             filter: menu.getFilter({ "read_only": false });
-            onRowsInserted: customSeparator.visible = rowCount() > 1
-            onRowsRemoved: customSeparator.visible = rowCount() > 1
-            onModelReset: customSeparator.visible = rowCount() > 1
+            onModelReset: customSeparator.visible = rowCount() > 0
         }
 
         MenuItem
@@ -50,8 +51,16 @@ import Cura 1.0 as Cura
             onTriggered: Cura.MachineManager.setActiveQuality(model.id)
         }
 
-        onObjectAdded: menu.insertItem(index, object);
-        onObjectRemoved: menu.removeItem(object);
+        onObjectAdded:
+        {
+            customSeparator.visible = model.rowCount() > 0;
+            menu.insertItem(index, object);
+        }
+        onObjectRemoved:
+        {
+            customSeparator.visible = model.rowCount() > 0;
+            menu.removeItem(object);
+        }
     }
 
     ExclusiveGroup { id: group; }