Browse Source

Inherit button now has the same behaviour as 2.1 again

CURA-1278
Jaime van Kessel 8 years ago
parent
commit
77431b01a3
1 changed files with 10 additions and 2 deletions
  1. 10 2
      resources/qml/Settings/SettingItem.qml

+ 10 - 2
resources/qml/Settings/SettingItem.qml

@@ -24,7 +24,7 @@ Item {
 
     // Create properties to put property provider stuff in (bindings break in qt 5.5.1 otherwise)
     property var state: propertyProvider.properties.state
-    property var stackLevel: propertyProvider.stackLevel
+    property var stackLevel: propertyProvider.stackLevels[0]
 
     signal contextMenuRequested()
     signal showTooltip(string text);
@@ -166,7 +166,15 @@ Item {
 
                 onClicked: {
                     focus = true;
-                    propertyProvider.removeFromContainer(base.stackLevel)
+                    // Get the deepest entry of this setting that we can find. TODO: This is a bit naive, in some cases
+                    // there might be multiple profiles saying something about the same setting. There is no strategy
+                    // how to handle this as of yet.
+                    var last_entry = propertyProvider.stackLevels.slice(-1)[0]
+                    // Put that entry into the "top" instance container.
+                    // This ensures that the value in any of the deeper containers need not be removed, which is
+                    // needed for the reset button (which deletes the top value) to correctly go back to profile
+                    // defaults.
+                    propertyProvider.setPropertyValue("value", propertyProvider.getPropertyValue("value", last_entry))
                 }
 
                 backgroundColor: UM.Theme.getColor("setting_control");