I need to fill the QML menu with MenuItems from the model
I found that I can do it like this:
Menu {
id: contextMenu
Instantiator {
model: menuItems
MenuItem {
text: model.text
}
// The trick is on those two lines
onObjectAdded: contextMenu.insertItem(index, object)
onObjectRemoved: contextMenu.removeItem(object)
}
}
What is described in this answer:
QML - Filling menu with model items
It partially work now, but I get an error:
Parameter "object" is not declared
And I don't understand which object I should pass to the function contextMenu.insertItem(index, object)