How can I remove/hide all toolbars from a QMainWindow?
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.
精彩评论