Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
5.11
-
e4901286c801162d6b9b94b10d23dafca73c5068
Description
A common use case would be a menu containing recent files.
It's possible to do this with Instantiator:
import QtQuick 2.7 import QtQuick.Controls 2.3 import Qt.labs.platform 1.0 as Platform ApplicationWindow { id: root visible: true width: 640 height: 480 property int model: 10 Timer { running: true repeat: true interval: 2000 onTriggered: { if (model > 1) --model } } Platform.MenuBar { Platform.Menu { title: "Menu" Platform.Menu { id: subMenu title: "Sub-menu" Platform.MenuItem { text: "A" } Platform.MenuItem { text: "B" } Instantiator { model: root.model delegate: Platform.MenuItem { text: "C" } onObjectAdded: subMenu.addItem(object) onObjectRemoved: subMenu.removeItem(object) } } } } }