In Qt, you can tabify dockWidgets. If I do that, the tabs show on the bottom of the dockWidgets, as is shown in the left sketch. This is the behavior I get under Windows 7 with the latest Qt4 and PyQt4. How can I tell Qt to place the tabs on the dockWidgets top as shown in the right sketch?
default: tabs on bottom I want: tabs on top
+--------------------+ +------+-----+
| dockWidget1 | | tab1 | tab2|-------+
| | | |
| tab1 | tab2|-------| | dockWidget1 |
+------+-----+ +--------------------+
You can call
QMainWindow.setTabPosition (self,
Qt.DockWidgetAreas areas,
QTabWidget.TabPosition tabPosition)
(Notice that this applies to the specific dock area, which means you can have different dock areas with various tab configurations.)
with the enumeration: Qt.DockWidgetAreas
and QTabWidget.TabPosition
:
#Qt.DockWidgetAreas
Constant Value
--------------------- -------
Qt.LeftDockWidgetArea 0x1
Qt.RightDockWidgetArea 0x2
Qt.TopDockWidgetArea 0x4
Qt.BottomDockWidgetArea 0x8
Qt.AllDockWidgetAreas DockWidgetArea_Mask
Qt.NoDockWidgetArea 0
#QTabWidget.TabPosition
Constant Value Description
---------- ------- -----------
QTabWidget.North 0 The tabs are drawn above the pages.
QTabWidget.South 1 The tabs are drawn below the pages.
QTabWidget.West 2 The tabs are drawn to the left of the pages.
QTabWidget.East 3 The tabs are drawn to the right of the pages.
(Reference: http://pyqt.sourceforge.net/Docs/PyQt4/qmainwindow.html#setTabPosition)
And here is the result:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With