vandelay vandelay - 1 year ago 71
Python Question

QDockWidget, place the tabs on top and insert text

Are there any methods to make the tabs be placed on top? I think it's more suitable. And is there an easy way to name the tabs, maybe add a QLabel.

Below is a picture of how it looks now.

enter image description here

Answer Source

Use setTabPosition to put the tabs at the top for the relevant dock-areas:

mainwindow.setTabPosition(QtCore.Qt.AllDockWidgetAreas, QtGui.QTabWidget.North)

The tab text is taken from the window title, so it can be set like this:


or indirectly via the QDockWidget constructor:

dockwidget = QtGui.QDockWidget('Name', parent)