View Full Version : How make QLabel always on top ?

1st November 2014, 04:35
I create a window with some widgets in a layout and there is a QLabel in a fixed position from right-bottom, while I create other widgets replacing old ones and put them into the old layout , which means the QLabel is created before the new widgets. Then the QLabel is shadowed by others. How could I set the QLabel on top all the way . I've tried setWindowFlags(Qt::WindowStaysOnTopHint), but it doesn't work.
Any suggestions?

1st November 2014, 07:29
If you don't want the content of the layout on top of the label then put the label in the layout. If there is a real reason you cannot do that then you probably want to call QWidget::raise() after fiddling with the layout.

1st November 2014, 13:37
What could also work is to have a container for the dynamically created widgets and have the label as a sibling of the container.


4th November 2014, 02:04
oh, thanks a lot . QWidget::raise() is ok.