From a070684ade3e89f6dbb18e2ba5d7692d07eafb4c Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 9 Jun 2016 09:59:06 +0200 Subject: [PATCH] Fixed minor issue for inheritance button It didn't always reset to correct value. CURA-1278 --- resources/qml/Settings/SettingItem.qml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/resources/qml/Settings/SettingItem.qml b/resources/qml/Settings/SettingItem.qml index 0cb1c169df..6095ab10d1 100644 --- a/resources/qml/Settings/SettingItem.qml +++ b/resources/qml/Settings/SettingItem.qml @@ -185,12 +185,22 @@ Item { // 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] + var last_entry = propertyProvider.stackLevels[propertyProvider.stackLevels.length] + + for (var i = 1; i < base.stackLevels.length; i++) + { + var has_setting_function = typeof(propertyProvider.getPropertyValue("value", base.stackLevels[i])) == "object"; + if(has_setting_function) + { + last_entry = propertyProvider.stackLevels[i] + break; + } + } // 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. - if(last_entry == 4 && base.stackLevel == 0) + if(last_entry == 4 && base.stackLevel == 0 && base.stackLevels.length == 2) { // Special case of the inherit reset. If only the definition (4th container) and the first // entry (user container) are set, we can simply remove the container.