Important: Please read the Qt Code of Conduct -

QMainWindow - always show QTabBar

  • You can enable stacking QDockWidgets when set QMainWindow::AllowTabbedDocks flag.

    That QTabBar will appear only when there is two widgets stacked in that docking area.

    I need that QTabBar to be shown always, even if there is just one widget, because i want to implement that when you click on the tab, the appropriate widget will hide/show.

    It looks that it is not possible, right?

  • Lifetime Qt Champion


    Indeed it's not, unless you modify Qt. But before doing that. What is your use case ? It seems you are going against most GUI guidelines.

  • @SGaist Hi. Currently the default QDockWidget title bar shows label and close and float buttons. When you have 2 QDockWidgets tabbed, than the QTabBar appears abowe the title bar (if set to show QTabBar on North). I don't like this behaviour when you have title bar with label and abowe that tab with same label. It looks weird. It is not needed to have 2 labels. I know i can have custom title bar widget, but that means i will need somehow to handle when the QTabBar is visible and when not (to show/hide title bar so there are not redundant informations like label).

    It could be best if i can hide the QTabBar, but still have that tabbify behaviour and some signal that is sended when QDockWidget is tabbed, so i can show everything in my custom title bar (like all tabs in that area, close/float buttons and other things i need).

    I will probably need to copy all the files from Qt and do it by myself (qmainwindow, qmainwindowlayout, qdockarealayout, qdockwidget), but this will take lot of times as i saw it is around 10k lines of code.

Log in to reply