1

My QMainWindow is using QMdiArea. The viewMode of the QMdiArea is set to TabbedView. The Tab size of MdiArea takes entire width of the MdiArea:

1 tab

If more tabs are added, they divide MdiArea width and consume entire width:

More tabs..

I understand that the MdiArea in tabbedView uses QTabBar, but I'm not able to find a way to set MdiArea's TabBar setExpanding property to false.

Any clue (Qt, PyQt or PySide) will be helpful.

ekhumoro
  • 115,249
  • 20
  • 229
  • 336
Ajay
  • 344
  • 3
  • 15

1 Answers1

2

The tab-bar of a QMdiArea can be accessed, but there's currently no public API for it. A work-around is to first ensure the view-mode is set to TabbedView, and then use findChild to get the QTabBar object. It will then be possible to change the expanding property of the tab-bar:

mdiArea.setViewMode(QMdiArea.TabbedView)
tabs = mdiArea.findChild(QTabBar)
tabs.setExpanding(False)
ekhumoro
  • 115,249
  • 20
  • 229
  • 336