MenuItem, like Menu, is not an Item but a plain QObject. To properly use
Instantiator, you need to hook into the objectAdded and objectRemoved signals,
Menu {
id: presetMenu
Instantiator {
model: 4
MenuItem {
text: “Index” + index
}
onObjectAdded: presetMenu.insertItem(index, object)
onObjectRemoved: presetMenu.removeItem(object)
}
}
Best regards,
Gabriel de Dietrich
Senior Software Developer
qt.digia.com<http://qt.digia.com>
On 23 Jun 2014, at 11:08, Tim Blechmann
<[email protected]<mailto:[email protected]>> wrote:
hi all,
trying to populated a menu with a model, i figured out that MenuItems
are not instantiated by a Repeater:
code:
--
Menu {
id: presetMenu
MenuItem {
text: "Menu Begin"
}
Repeater {
model: 4
MenuItem {
text: "Index " + index
}
}
MenuItem {
text: "Menu End"
}
}
--
this code gives me a menu with "Menu Begin" and "Menu End", but no menu
entries in between. any idea what i'm doing wrong here?
thnx,
tim
_______________________________________________
Interest mailing list
[email protected]<mailto:[email protected]>
http://lists.qt-project.org/mailman/listinfo/interest
_______________________________________________
Interest mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/interest