PDA

View Full Version : How make QLabel always on top ?



lwz
1st November 2014, 03: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?

ChrisW67
1st November 2014, 06: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.

anda_skoa
1st November 2014, 12: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.

Cheers,
_

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