Component render on top of all popups
-
Hello all
I have created a PointHandler that I would like to rest on top of my application, monitoring for a particular gesture (in this case, simultaneous presses in the 4 corners of the screen) to trigger an action.
I have my object in my root componenet with a z value set so that is displaying on top of everything else. However my application shows popups, and those popups wil ldisplay on top of my PointHandler, prevent it from working properly.
Is there a way to set a componenet to display on top of EVERYTHING, including popups?
-
For future reference, the only solution I was able to find here was to make my component itself a popup and give it a z value of 1000. This was not ideal however, to prevent the popup from stealing the events to the item below it, I had to do some trickery with its height and width, and then I had to repopen the popup every second because user intereaction would keep closing it.
This only works because my component is just monitoring user input for a specific interaction, it is unworkable for any other solution.
Here is a segment of the code I used
// Use a popup to get the FourCornerPressArea to display over everything, including other popups. Controls.Popup { id: popup // Give this popup no width or height so it doesn't block interactions to the layer below. // There doesn't appear to be any other way to achieve this. width: 0 height: 0 margins: 0 padding: 0 modal: false z: 1000 background: Item {} contentItem: Item { MyComponent { width: root.width height: root.height } } } Timer { // Because we are using a popup to get the FourCornerPressArea to display over everything, we have to reopen it // every few seconds, because user interaction deletes the popup. running: true repeat: true interval: 1000 onTriggered: popup.open() }if anyone knows a better way to do this, I would apprecaite it, because this is awful.
The only other solution I can think of is to simply remove the QtQuick Popup component from our entire app and reimplement a custom version that behaves the way we want it to.
-
For future reference, the only solution I was able to find here was to make my component itself a popup and give it a z value of 1000. This was not ideal however, to prevent the popup from stealing the events to the item below it, I had to do some trickery with its height and width, and then I had to repopen the popup every second because user intereaction would keep closing it.
This only works because my component is just monitoring user input for a specific interaction, it is unworkable for any other solution.
Here is a segment of the code I used
// Use a popup to get the FourCornerPressArea to display over everything, including other popups. Controls.Popup { id: popup // Give this popup no width or height so it doesn't block interactions to the layer below. // There doesn't appear to be any other way to achieve this. width: 0 height: 0 margins: 0 padding: 0 modal: false z: 1000 background: Item {} contentItem: Item { MyComponent { width: root.width height: root.height } } } Timer { // Because we are using a popup to get the FourCornerPressArea to display over everything, we have to reopen it // every few seconds, because user interaction deletes the popup. running: true repeat: true interval: 1000 onTriggered: popup.open() }if anyone knows a better way to do this, I would apprecaite it, because this is awful.
The only other solution I can think of is to simply remove the QtQuick Popup component from our entire app and reimplement a custom version that behaves the way we want it to.
@Joe-McGuchan on the widgets side you have this setWindowFlags(Qt::WindowStaysOnTopHint);
on the QML side you have the property flags of Window
flags: Qt.WindowStaysOnTopHint