Pop up Menu outside QtWindow
Unsolved
QML and Qt Quick
-
Hi, for reasons that are immovable, I need to pop up a qt quick menu outside the QtQuickWindow.
Qt doesn't allow this, and will try to reposition the menu inside the window if popped up outside.
I was able to make it pop up where I wanted by first calling popup in 0,0 and then moving the contentItem and background to my desired location.
However, the ClickedOutside area still believes the menu is at 0,0, so there is a patch in the top left corner that doesn't close the menu when pressed.import QtQuick 2.14 import QtQuick.Controls 2.4 as CTL CTL.Menu { id: root function makeAppear(x, y) { popup(0, 0) contentItem.x = x contentItem.y = y background.x = x background.y = y } modal: true CTL.Overlay.modal: Rectangle { scale: 2 color: "#55000000" } }
I tried adding a mouseArea, hoping that that would appear in the pre-moved location, but I'm never able to get a print from it.
property var hack: MouseArea { id: hack height: root.height width: root.width x: root.x y: root.y onClicked: console.log("clicked the thing") }
Any suggestions?