From df8d0e9b469a6682d08c71655f6d8c1b05d07418 Mon Sep 17 00:00:00 2001 From: Joey de l'Arago Date: Fri, 2 Dec 2022 18:01:12 +0100 Subject: [PATCH] Make it easier to override how the settingComboBox updates a setting. CURA-9793 --- resources/qml/Widgets/SingleSettingComboBox.qml | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/resources/qml/Widgets/SingleSettingComboBox.qml b/resources/qml/Widgets/SingleSettingComboBox.qml index 151a9b1cd9..5c56fedb9c 100644 --- a/resources/qml/Widgets/SingleSettingComboBox.qml +++ b/resources/qml/Widgets/SingleSettingComboBox.qml @@ -58,13 +58,19 @@ Cura.ComboBox { function onIsValueUsedChanged() { comboboxModel.updateModel() } } - onCurrentIndexChanged: updateSetting() + onCurrentIndexChanged: parseValueAndUpdateSetting() + + function parseValueAndUpdateSetting() + { + if (comboboxModel.get(currentIndex) && comboboxModel.get(currentIndex).code != propertyProvider.properties.value) + { + updateSetting(comboboxModel.get(currentIndex).code) + } + + } function updateSetting(value) { - if (comboboxModel.get(currentIndex) && comboboxModel.get(currentIndex).code) - { - propertyProvider.setPropertyValue("value", comboboxModel.get(currentIndex).code) - } + propertyProvider.setPropertyValue("value", value) } }