From 8012cb5360722161553e3469ca7bd2a8d9314c7a Mon Sep 17 00:00:00 2001 From: Joey de l'Arago Date: Wed, 7 Dec 2022 17:16:26 +0100 Subject: [PATCH] Signal are being emmitted before settings are updated. This is causing the combobox to update with the previous value. Only when using infill_pattern setting though. No idea what is causing this. This is a workaround for now. CURA-9793 --- .../qml/Widgets/SingleSettingComboBox.qml | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/resources/qml/Widgets/SingleSettingComboBox.qml b/resources/qml/Widgets/SingleSettingComboBox.qml index 95b2c5d86a..0055c00262 100644 --- a/resources/qml/Widgets/SingleSettingComboBox.qml +++ b/resources/qml/Widgets/SingleSettingComboBox.qml @@ -44,6 +44,10 @@ Cura.ComboBox { if (propertyProvider.properties.value == key) { + print("propertyProvider.properties.value: " + propertyProvider.properties.value) + print("key: " + key) + print("currentIndex: " + currentIndex) + print("i: " + i) // The combobox is cleared after each value change so the currentIndex must be set each time. currentIndex = i } @@ -51,6 +55,17 @@ Cura.ComboBox { } } + // Updates to the setting are delayed by interval. The signal onIsValueUsedChanged() is emitted early for some reason. + // This causes the selected value in the combobox to be updated to the previous value. (This issue is present with infill_pattern setting) + // This is a hack. If you see this in the future, try removing it and see if the combobox still works. + Timer + { + id: updateTimer + interval: 100 + repeat: false + onTriggered: comboboxModel.updateModel(false) + } + property UM.SettingPropertyProvider propertyProvider: UM.SettingPropertyProvider { id: propertyProvider @@ -61,8 +76,8 @@ Cura.ComboBox { Connections { target: propertyProvider - function onContainerStackChanged() { comboboxModel.updateModel() } - function onIsValueUsedChanged() { comboboxModel.updateModel() } + function onContainerStackChanged() { updateTimer.restart() } + function onIsValueUsedChanged() { updateTimer.restart() } } onCurrentIndexChanged: parseValueAndUpdateSetting() @@ -80,6 +95,7 @@ Cura.ComboBox { { if (updateAllExtruders) { + print("UPDATING ALL WITH VALUE: " + value) Cura.MachineManager.setSettingForAllExtruders(propertyProvider.key, "value", value) } else