Details
-
Bug
-
Resolution: Unresolved
-
P4: Low
-
None
-
6.5.2
-
None
Description
I found that QML Menu popup API is not working as expected if the Menu is a subMenu of another Menu in some circumstances. Minimal Reproducer:
ApplicationWindow { id: window menuBar: MenuBar { Menu { title: qsTr("&Edit") Menu { title: qsTr("&Help") Action { text: qsTr("&About") } Action { text: qsTr("&Copy") } Action { text: qsTr("&Paste") } } Action { text: qsTr("Cu&t") } delegate: MenuItem { onHoveredChanged: { if (hovered && subMenu) { subMenu.popup(this, 0, 500); } } } } } width: 400 height: 300 visible: true }
No matter how I modify "subMenu.popup(this, 0, 500);", e.g. positive/negative coordinates, binding to other geometries, mapfromglobal/maptoglobal, assigning different parents, etc., it makes no difference. subMenu "Help" always pops at the same position, i.e. visually aligned to the MenuItem.
The only way I found so far is to have an Item positioned w.r.t ApplicationWindow and use it as parent to subMenu.popup. But ding so makes it very difficult to position subMenu w.r.t parent menu.