From 0e5ad96207c8dab6efebd5e799460469c5621ea9 Mon Sep 17 00:00:00 2001 From: Joey de l'Arago Date: Wed, 7 Dec 2022 16:15:09 +0100 Subject: [PATCH] Fix bad call to keys function on string. Also fix assigning currentIndex to correct Component. CURA-9793 --- resources/qml/MachineSettings/ComboBoxWithOptions.qml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/resources/qml/MachineSettings/ComboBoxWithOptions.qml b/resources/qml/MachineSettings/ComboBoxWithOptions.qml index 18c8745f17..2c82f07c6f 100644 --- a/resources/qml/MachineSettings/ComboBoxWithOptions.qml +++ b/resources/qml/MachineSettings/ComboBoxWithOptions.qml @@ -74,6 +74,12 @@ UM.TooltipArea return } + if (typeof propertyProvider.properties["options"] == "string") + { + return + } + + for (var i = 0; i < propertyProvider.properties["options"].keys().length; i++) { var key = propertyProvider.properties["options"].keys()[i] @@ -82,7 +88,7 @@ UM.TooltipArea if (propertyProvider.properties.value == key) { - currentIndex = i + comboBox.currentIndex = i } } } @@ -126,7 +132,7 @@ UM.TooltipArea onActivated: { var newValue = model.get(index).value - if (propertyProvider.properties.value != newValue) + if (propertyProvider.properties.value != newValue && newValue != undefined) { if (setValueFunction !== null) { @@ -134,6 +140,7 @@ UM.TooltipArea } else { + print("SETTING PROPERTY VALUE: " + newValue) propertyProvider.setPropertyValue("value", newValue) } forceUpdateOnChangeFunction()