mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-08-09 06:45:09 -06:00
Reset tab index when repeater's model is rebuilt
We can't prevent the model from being rebuilt. At least, not without a major refactor. Contributes to issue CURA-5876.
This commit is contained in:
parent
e93bbf07a4
commit
1d9a13cac2
1 changed files with 13 additions and 0 deletions
|
@ -39,6 +39,7 @@ Item
|
|||
|
||||
Repeater
|
||||
{
|
||||
id: repeater
|
||||
model: extrudersModel
|
||||
delegate: UM.TabRowButton
|
||||
{
|
||||
|
@ -59,6 +60,18 @@ Item
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
//When the model of the extruders is rebuilt, the list of extruders is briefly emptied and rebuilt.
|
||||
//This causes the currentIndex of the tab to be in an invalid position which resets it to 0.
|
||||
//Therefore we need to change it back to what it was: The active extruder index.
|
||||
Connections
|
||||
{
|
||||
target: repeater.model
|
||||
onModelChanged:
|
||||
{
|
||||
tabBar.currentIndex = Math.max(Cura.ExtruderManager.activeExtruderIndex, 0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue