From 1d9a13cac27c4e8c571c53757ec81882d1c8994a Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 30 Nov 2018 15:40:59 +0100 Subject: [PATCH] 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. --- .../Menus/ConfigurationMenu/CustomConfiguration.qml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml b/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml index 8ad512349b..bdf5ccfaa1 100644 --- a/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml +++ b/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml @@ -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