开发者

How can I remove/hide all toolbars from a QMainWindow?

开发者 https://www.devze.com 2023-03-11 03:43 出处:网络
I have a third party QMainWindow and I need to embed it in my own QMainWindow (i.e. use it as a normal widget). I know it\'s not a best practise (to say the least) but I have no other way right now.

I have a third party QMainWindow and I need to embed it in my own QMainWindow (i.e. use it as a normal widget). I know it's not a best practise (to say the least) but I have no other way right now.

I need to hide the third-party window's statusbar, menubar and toolbars. I was开发者_JAVA技巧 able to remove the statusbar (setStatusBar(0)) and the menubar (setMenuBar(0)) but I cannot find a way to do the samething with the toolbar area

Is there any way to hide/remove toolbars?


I suggest you get the pointer of the StatusBar,MenuBar, and call hide() on them.

As for the toolbars, you should find them:

QList<QToolBar *> toolbars = mainWindow.findChildren<QToolBar *>();

Then call hide() for them.

0

精彩评论

暂无评论...
验证码 换一张
取 消