Fix sidebar loading and unloading depending on active stage

This commit is contained in:
ChrisTerBeke 2017-12-06 17:46:18 +01:00
parent 2d044a37ae
commit ee643610e5
7 changed files with 601 additions and 603 deletions

View file

@ -403,8 +403,6 @@ Item
}
}
//
// Infill
//
@ -568,18 +566,24 @@ Item
model: infillModel
anchors.fill: parent
property int activeIndex: {
function activeIndex () {
for (var i = 0; i < infillModel.count; i++) {
var density = parseInt(infillDensity.properties.value)
var steps = parseInt(infillSteps.properties.value)
var infillModelItem = infillModel.get(i)
if (density >= infillModelItem.percentageMin
// TODO: somehow this print causes this method not to crash QML when the sidebar view gets unloaded (when switching states)
// TODO: That should be fixed :P
print("test", density, steps, infillModelItem)
if (infillModelItem
&& density >= infillModelItem.percentageMin
&& density <= infillModelItem.percentageMax
&& steps >= infillModelItem.stepsMin
&& steps <= infillModelItem.stepsMax){
return i
}
&& steps <= infillModelItem.stepsMax
){
return i
}
}
return -1
}
@ -587,7 +591,7 @@ Item
Rectangle
{
anchors.fill: parent
visible: infillIconList.activeIndex == index
visible: infillIconList.activeIndex() == index
border.width: UM.Theme.getSize("default_lining").width
border.color: UM.Theme.getColor("quality_slider_unavailable")