diff --git a/resources/qml/Menus/ContextMenu.qml b/resources/qml/Menus/ContextMenu.qml index 65f3409c8a..f7029939cd 100644 --- a/resources/qml/Menus/ContextMenu.qml +++ b/resources/qml/Menus/ContextMenu.qml @@ -44,8 +44,19 @@ Cura.Menu onTriggered: CuraActions.setExtruderForSelection(model.id) shortcut: "Ctrl+" + (model.index + 1) } - // Add it to the fifth position (and above) as we want it to be added after the extruder header. - onObjectAdded: function(index, object) { base.insertItem(index + 5, object) } + + onObjectAdded: function(index, object) { + var extruder_header_location = 5; + // Find the location of the extruder header and insert it below that. + for (var i = 0; i < base.count; i++) + { + if(base.itemAt(i) === extruderHeader) + { + extruder_header_location = i + 1; + } + } + base.insertItem(extruder_header_location + index, object) + } onObjectRemoved: function(index, object) { base.removeItem(object) } }