Set Z-Order of Windows?
-
I have 4 windows that have the WindowStaysOnTopHint applied to them; is it possible to manually set their z-orders?
-
@Qt_User72653
It depends on the windows manger.
you can try call raise ()
but im not sure it works with WindowStaysOnTopHint -
I've tried using raise() but the results have been inconsistent, with the z-order of some windows changing spontaneously. Or, in the case I'm struggling with now, calling raise does nothing initially then later another call to raise actually raises the window.
I was hoping there was a way to set it absolutely.
-
@Qt_User72653
I had similar results on windows.
What platform are you on ?
I never saw a function to explicitly set the the z order value.note on windows, i had ok result calling
->activateWindow(); ->raise()
to bring a top window to the very front of other tops. -
Windows 10.
I guess I'll look into doing this with the Windows API.
-
@Qt_User72653
Is the goal to control stacking order or
be able to bring top window in front on demand ?
if yes to bringtofront, can you try with
->setWindowState(Qt::WindowActive) ; -
To control the stacking order.
The issue with using activateWindow is that the windows represent a pop-up dialog with a dropdown menu. One window represents the dialog with the line edit and another represents the dropdown list, so activating the window I want to raise takes the focus from the line edit window.
On top of that, both the dialog and the dropdown list windows' have another window that follow them around that's used to draw a drop shadow. This is where the issue is because the drop shadow for the dialog window overlaps the window for the dropdown list.
-
@Qt_User72653
Did you try fiddling around with FocusPolicy
http://doc.qt.io/qt-5/qwidget.html#focusPolicy-prop
so only clicking will take focus ?
Not sure it helps but no harm mentioned it. -
@Qt_User72653
Hi
I mean for the case
"activating the window I want to raise takes the focus from the line edit window."
but it was a thought.