mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-08-05 13:03:59 -06:00
Fix extruder number
most important change was changing ``` currentIndex: function () { ... } ``` to currentIndex: { ... } ``` This changed the behavior so that the variables inside the code blocked are watched so that `currentIndex` is automatically updated. No longer needed to set the `currentIndex` from any where else anymore. CURA-10374
This commit is contained in:
parent
dc22a4980c
commit
71a0044bf8
2 changed files with 10 additions and 17 deletions
|
@ -72,23 +72,16 @@ UM.TooltipArea
|
|||
return;
|
||||
}
|
||||
|
||||
if (typeof propertyProvider.properties["options"] === "string") {
|
||||
if (typeof(propertyProvider.properties["options"]) === "string") {
|
||||
return;
|
||||
}
|
||||
|
||||
let currentIndex = -1;
|
||||
const keys = propertyProvider.properties["options"].keys();
|
||||
for (let index = 0; index < propertyProvider.properties["options"].keys().length; index ++) {
|
||||
const key = propertyProvider.properties["options"].keys()[index];
|
||||
const value = propertyProvider.properties["options"][key];
|
||||
|
||||
if (propertyProvider.properties.value === key) {
|
||||
currentIndex = index;
|
||||
}
|
||||
defaultOptionsModel.append({ text: value, value: key });
|
||||
}
|
||||
|
||||
comboBox.currentIndex = currentIndex;
|
||||
}
|
||||
|
||||
Component.onCompleted: updateModel()
|
||||
|
@ -112,7 +105,7 @@ UM.TooltipArea
|
|||
model: defaultOptionsModel
|
||||
textRole: "text"
|
||||
|
||||
currentIndex: function () {
|
||||
currentIndex: {
|
||||
const currentValue = propertyProvider.properties.value
|
||||
for (let i = 0; i < model.count; i ++) {
|
||||
if (model.get(i).value === currentValue) {
|
||||
|
@ -123,7 +116,6 @@ UM.TooltipArea
|
|||
}
|
||||
|
||||
onActivated: function (index) {
|
||||
const key = propertyProvider.properties["options"].keys()[index];
|
||||
const newValue = model.get(index).value;
|
||||
|
||||
if (propertyProvider.properties.value !== newValue && newValue !== undefined) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue