2
votes

There is a QMainWindow and two QDockWidgets. The first widget is docked to the top, the second - to the left. The result is that the first widget occupies full width and the second widget occupies the remaining area. I want to make it so that the second widget occupies the full height and the first - the remaining area.

To show this visually. "-" - the first widget, "|" - the second, o - central widget.

Default Qt behavior:

------
|ooooo
|ooooo
|ooooo

I need this:

|-----
|ooooo
|ooooo
|ooooo
1

1 Answers

4
votes

Please take a look at the QMainWindow::​setCorner() documentation. This will allow you to customize corner -> dockwidget_area.

For example, according to your question, you should call:

QMainWindow * w = ...;
w->setCorner(Qt::TopLeftCorner, Qt::LeftDockWidgetArea);

to associate the top left corner with the left dockwidget area.

simple!