How to toggle widget "always on top"
-
I want to have a child window that is not always on top, which seems to be the default.
I have tried the following, but it doesn't seem to have any effect.
@ Qt::WindowFlags flags = dialog->windowFlags();
dialog->setWindowFlags( flags ^ ( Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint) );@Ultimately I only have a parent widget because I can't figure out how to reliably center the child when there is no parent, and this seems like it would have an easier solution.
-
I quickly noticed that i was actually trying to turn it on with the code above.
Upon further investigation, I found that the flag I was trying to unset isn't set at all in the first place, so unsetting it obviously didn't help.
Is there a 'right way' to set a widget (dialog) to not stay on top?