Details
-
Bug
-
Resolution: Incomplete
-
P2: Important
-
None
-
5.9.2, 5.15.2, 6.5.0 Beta3
-
Linux, KDE neon
Description
I have a menu with some static and some dynamic items. The dynamic ones are instantiated using a Repeater. After changing the model, the items instantiated by the Repeater are inserted at the end of the menu. Expected is that they are inserted at the position of the repeater.
To reproduce, try the code example below:
import QtQuick 2.7 import QtQuick.Controls 2.0 import QtQuick.Layouts 1.3 ApplicationWindow { visible: true width: 640 height: 480 title: qsTr("Hello World") header: ToolBar { id: toolBar Row { id: buttons ToolButton { id: menuButton onClicked: menu.open() text: "open" } ToolButton { id: showButton checkable: true text: checked ? "hide" : "show" } } } Menu { id: menu MenuItem { text: "Begin" } Repeater { id: repeater model: showButton.checked ? 4 : 2 delegate: MenuItem { text: index } } MenuItem { text: "End" } } }
- Click open to open the menu. The menu items should have the following correct order:
- Begin
- 0
- 1
- End
- Click the button "show" and open the menu again.
- Expectation:
- Begin
- 0
- 1
- 2
- 3
- End
- Result:
- Begin
- End
- 0
- 1
- 2
- 3
- Expectation: