Get a window back on normal level after put it on top level
-
Hello guys!
On my window i have a checkbox button that allows me to put the window on top level when it is checked and on normal window when it is unchecked. This is how i am trying to reach that but it is not working.
Thanks for help!!Qt::WindowFlags flags = this->windowflags(); if(ui->istopLvlcheckBox->isChecked()){ flags |= Qt::WindowStaysOnTopHint; }else{ flags &= ~Qt::WindowStaysOnTopHint; } this->setWindowFlags(flags); this->show(); -
Hi and welcome to devnet,
Can you check the window flag example to see it's working properly ?
-
Which OS/Qt version are you running ?
-
That's the Qt Creator version, which one is Qt itself ?
Also, can you test the same thing with your distribution provided Qt ?
-
Try adding the
Qt::X11BypassWindowManagerHintto your calls changing the flags. -
According to the documentation Qt::X11BypassWindowManagerHint means that the window will be borderless
and that is exactly what it becomes when I add that flag. The point is when i try to debug the code in my first message like this (qDebug() << windowFlags() ), I have something like this:- when the checkbox is checked:
QFlags<Qt::WindowType>(Window|X11BypassWindowManagerHint|WindowTitleHint|WindowSystemMenuHint|WindowMinMaxButtonsHint|WindowStaysOnTopHint|WindowCloseButtonHint|WindowFullscreenButtonHint)--when it is unchecked :
QFlags<Qt::WindowType>(Window|X11BypassWindowManagerHint|WindowTitleHint|WindowSystemMenuHint|WindowMinMaxButtonsHint|WindowCloseButtonHint|WindowFullscreenButtonHint)As you can see when it is unchecked there is no WindowStaysOnTopHint flag anymore but i do not know why it is not working.
-
Might be related to QTBUG-53711