I am using QDockWidgets and placing two of them on the left side of my application so that tabs can be used to select between them. However, Qt's default behavior for this looks horrible and is unintuitive. Instead of being able to drag the tabs to move the widgets, it places another bar below the selected tab (with the same name) that must be dragged instead. As a user, it would be hard to figure this out.
(My QDockWidgets are "Attributes" and "Library")
Is there a way to get rid of this second bar and make it so I can move my QDockWidgets by dragging the tabs themselves?
If you are adding QTabWidgets
to a main window derived from QMainWindow
, you can try tabifyDockWidget
.
It tabifies two QDockWidgets
just like you wanted and of course you are able to drag them.
dockWidget1 = new QDockWidget("Tab1") ;
dockWidget2 = new QDockWidget("Tab2") ;
this->addDockWidget(Qt::LeftDockWidgetArea , dockWidget1 );
this->addDockWidget(Qt::LeftDockWidgetArea , dockWidget2 );
this->tabifyDockWidget(dockWidget1,dockWidget2);