From bca27ad11fc34fbd2872d14da3dfc942d9052fec Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Mon, 24 Apr 2017 13:13:00 +0200 Subject: [PATCH] Document findItemIndex function in ContextMenu --- resources/qml/Menus/ContextMenu.qml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/resources/qml/Menus/ContextMenu.qml b/resources/qml/Menus/ContextMenu.qml index 14395aba6c..43867a4cc1 100644 --- a/resources/qml/Menus/ContextMenu.qml +++ b/resources/qml/Menus/ContextMenu.qml @@ -114,12 +114,22 @@ Menu } } + // Find the index of an item in the list of child items of this menu. + // + // This is primarily intended as a helper function so we do not have to + // hard-code the position of the extruder selection actions. + // + // \param item The item to find the index of. + // + // \return The index of the item or -1 if it was not found. function findItemIndex(item) { for(var i in base.items) { if(base.items[i] == item) + { return i; + } } return -1; }