Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix NaN values on material print settings tab #1686

Merged
merged 2 commits into from
Apr 18, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions resources/qml/Preferences/MaterialView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -273,17 +273,28 @@ TabView
{
id: spinBox
anchors.left: label.right
value: parseFloat(provider.properties.value);
width: base.secondColumnWidth;
value: {
if (!isNaN(parseFloat(materialPropertyProvider.properties.value)))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps call parseFloat() just once? For example:

parsedValue = parseFloat(materialPropertyProvider.properties.value);
if (!isNaN(parsedValue))
    ...

{
return parseFloat(materialPropertyProvider.properties.value);
}
if (!isNaN(parseFloat(machinePropertyProvider.properties.value)))
{
return parseFloat(machinePropertyProvider.properties.value);
}
return 0;
}
width: base.secondColumnWidth
readOnly: !base.editingEnabled
suffix: model.unit
suffix: " " + model.unit
maximumValue: 99999
decimals: model.unit == "mm" ? 2 : 0

onEditingFinished: provider.setPropertyValue("value", value)
onEditingFinished: materialPropertyProvider.setPropertyValue("value", value)
}

UM.ContainerPropertyProvider { id: provider; containerId: base.containerId; watchedProperties: [ "value" ]; key: model.key }
UM.ContainerPropertyProvider { id: materialPropertyProvider; containerId: base.containerId; watchedProperties: [ "value" ]; key: model.key }
UM.ContainerPropertyProvider { id: machinePropertyProvider; containerId: Cura.MachineManager.activeDefinitionId; watchedProperties: [ "value" ]; key: model.key }
}
}
}
Expand Down