qt - Can a QToolbar be added to a QDockWidget?
问题描述
I have setup my app to have various dock windows within the main window. I am also able to add a toolbar to the main window. However, I would ideally like to add the QToolBar inside one of the QDockWindow instances (or the QWidget that it houses) as the toolbar will be specific to that window.
Is this possible? I'm using a recent version of Qt, 5.10.
解决方案
我认为这是可能的。
1.QDockWidget
可以设置一个QMainWindow
bysetWidget()
方法。
QMainWindow
仅用于主窗口,但不会阻止将其用作子小部件。
2.QToolBar
可以通过addToolBar()
方法附加到主子窗口。
3.subwidget-mainwindow自然可以有自己的QToolbar
。
如果您不想QMainWindow
用作其 的小部件QDockWidget
,您可以将 附加QToolBar
为 的子小部件QDockWidget
。但是工具栏不能像 QMainWindow 那样移动。
我认为您想将其添加QToolBar
并用作QMainWindow
. 因此,我建议您将 a 设置QMainWindow
为 . 的小部件,然后QDockWidget
将您喜欢的任何小部件附加到主窗口。
推荐阅读
- elasticsearch - logstash geo_point 错误麋鹿纬度必须是数字
- android - 如何使 Jetpack 撰写复选框四舍五入
- java - 已经赋值后如何修改对象属性的值?
- java - 当结果是 Map 类型(不是 ConcurrentHashMap)时,执行“并发减少”是否有效?
- c++ - 如何检查所有向量值是否等于确定值
- python - 如何从行中提取列名并将它们提升为标题?
- c++ - 具有多个可执行文件的 C++ Makefile 自动依赖
- python - UnboundLocalError Python 烧瓶
- sql - SQL - 使联接查询更快
- file - 有什么方法可以删除损坏的 x-wav 文件?