[英]Using main menu as toolbar in Qt
I'd like to create a toolbar that contains main menu, just like the standard main menu at the top of the window. 我想创建一个包含主菜单的工具栏,就像窗口顶部的标准主菜单一样。
Is there some fast way to do this in QT ? QT中有一些快速的方法吗? I know that I can create a toolbar with buttons and context menus :-)
我知道我可以使用按钮和上下文菜单创建工具栏:-)
Thx for help. 谢谢。
You can add any widget to QToolBar using: 您可以使用以下任何方法将小部件添加到QToolBar:
QMenuBar *mb = new QMenuBar();
QToolBar::addWidget(mb);
It might be easier to reparent designer's ui->menubar to toolbar. 将Designer的ui-> menubar重置为工具栏可能会更容易。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.