How keep a QWidget always on top?

2019-06-16 19:51发布

I have two buttons on my QMainWindow. One to btnShowKb and another btnHideKb. When i press btnShowKb it shows an QWidget. I want this QWidget always to be on top of all windows till I press btnHideKb. When its on top, I want both QWidget and QMainWidget be activated.

Can anybody suggest on this?

2条回答
女痞
2楼-- · 2019-06-16 20:10

Nokia was so yesterday...

New link: http://doc.qt.io/qt-5/qtwidgets-widgets-windowflags-example.html

and the line of code you might be looking for:

mainMenu->setWindowFlags(Qt::WindowStaysOnTopHint);
查看更多
不美不萌又怎样
3楼-- · 2019-06-16 20:25
登录 后发表回答