如何从 QMainWindow 中删除栏 [英] How to remove bar from QMainWindow
本文介绍了如何从 QMainWindow 中删除栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试删除此栏,但无法删除它(它位于工具栏下方):
I'm trying to delete this bar, butI can't get rid of it (it's locate just under the toolbar):
那个酒吧的名字是什么,我如何访问它?谢谢.
What is the name of that bar,how can I access it? Thank you.
推荐答案
如果你添加了那个工具栏,你可能有一个指向它的指针?如果是,您可以简单地调用:
If you added that tool bar you probably have a pointer to it? If yes, you can simply call:
removeToolBar(toolbar);
在您的 QMainWindow
类中.否则,您可以从主窗口中删除所有工具栏:
in your QMainWindow
class. Otherwise you can remove all tool bars from the main window as:
QList<QToolBar *> allToolBars = mainWindow->findChildren<QToolBar *>();
foreach(QToolBar *tb, allToolBars) {
// This does not delete the tool bar.
mainWindow->removeToolBar(tb);
}
这篇关于如何从 QMainWindow 中删除栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文