I have an application with three dock widgets. Those are created by the following code:
dock = new QDockWidget(tr("Some title"));
dock->setWidget(some_widget);
dock->setContextMenuPolicy(Qt::PreventContextMenu);
dock->setFeatures(QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable);
addDockWidget(Qt::TopDockWidgetArea, dock);
dock2
and dock3
are then tabified by
tabifyDockWidget(dock1, dock2);
tabifyDockWidget(dock2, dock3);
The window then looks like this:
I can arrange the docks side by side by dragging and dropping them, so that the window looks like this:
I'd like to do this programmatically, but I can't figure out how. When doing a
splitDockWidget(dock1, dock2, Qt::Horizontal);
nothing happens. When doing
splitDockWidget(dock1, dock2, Qt::Vertical);
dock1
and dock2
disappear, and only dock3
is still visible:
After manually dragging it out of the main window and back in, the window looks like this:
So what am I doing wrong here?