问题描述
我的应用程序中有很多小部件,我知道我可以在运行时拖动它们并将其放置在另一个小部件上以合并它们(这两个小部件都在同一位置,并且它们下面有选项卡,我可以使用它们来切换他们).
I have a lot of widgets in my application and I know I can drag them during runtime and place over another widget in order to merge them (both widgets are on same place and there are tabs under them which I can use to switch them).
如何从头开始以编程方式插入QDockWidget?
How can I insert QDockWidget like this programmatically from start?
例如,我想在底部添加2个带有标签的QDockWidget,以便它们位于同一区域,并且可以通过标签进行切换
For example I want to add 2 QDockWidgets to bottom that are tabbed so that they are in same area and I can tab-switch them
推荐答案
如果您想将两个或多个停靠小部件布置为选项卡式窗口,则可以将一个停靠小部件拖到另一个之上(如您正确描述的那样),或者执行使用 QMainWindow :: tabifyDockWidget(QDockWidget * first,QDockWidget * second)
函数进行编程.正如功能描述所述:
If you want to layout two or more dock widgets as tabbed windows, you can either drag one dock widget over the other (as you properly described), or do that programaticaly using QMainWindow::tabifyDockWidget(QDockWidget *first, QDockWidget *second)
function. As the function description says:
这篇关于如何将QDockWidget作为选项卡插入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!