[Interest] [qtquick] Menu & Repeater
deDietrich Gabriel
Gabriel.deDietrich at digia.com
Mon Jun 23 22:14:50 CEST 2014
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 <tim at klingt.org<mailto:tim at klingt.org>> 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
Interest at qt-project.org<mailto:Interest at qt-project.org>
http://lists.qt-project.org/mailman/listinfo/interest
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20140623/40dd6836/attachment.html>
More information about the Interest
mailing list