19

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).

How can I insert QDockWidget like this programmatically from start?

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

Petr
  • 13,747
  • 20
  • 89
  • 144

1 Answers1

26

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:

Moves second dock widget on top of first dock widget, creating a tabbed docked area in the main window.

vahancho
  • 20,808
  • 3
  • 47
  • 55