Make it easier to override how the settingComboBox updates a setting.

CURA-9793
This commit is contained in:
Joey de l'Arago 2022-12-02 18:01:12 +01:00
parent 02572311bf
commit df8d0e9b46

View File

@ -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)
}
}