Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How to Add multiple Qtoolbar in QtabWidget



  • I want to create a tabwidget which will have tabs in left , right and top.

    Currently by using the default tabwidget i can have only one toolbar at any location(left,right,top or bottom).
    But i want to add 3 toolbars on 3 sides or is there anyway i can split tabs in default toolbar to different sides of widgets.
    I want tabwidget something like the below image:
    tabwidget.JPG



  • @vicky_mac

    You'll need to subclass QTabWidget and write a custom one. The standard QTabWidget can only have one tabbar (top, left, right or bottom), so you have to write your own widget either with one TabBar which goes around your widget or with three TabBars (one on each side; standard TabWidget holds one TabBar only). Maybe you have to subclass QTabBar as well...

    The easy way is to use two or three QTabWidgets next to each other (or maybe inside a QStackedWidget container). This is not exactly what you are asking for but the other solution might be a little tough, if you have never done this before.



  • @Pl45m4 said in How to Add multiple Qtoolbar in QtabWidget:

    maybe inside a QStackedWidget container

    Hi ,
    Thanks for suggestion. Do you have any example or link somewhat similar to what you suggested .
    Haven't used QT much so little help will be required.



  • @vicky_mac

    A QStackedWidget works like a book. You have pages with your content. You can flip these pages to change your widget inplace (without opening another window or something else).
    So one possibility is to put one of each QTabWidget (each with a different tabBar position) on a page of a QStackedWidget. You could flip the pages by clicking a dummy tab on each tabBar or you use a button to go to the next page. I know, this is not exactly what the widget in your image looks like :)

    @vicky_mac said in How to Add multiple Qtoolbar in QtabWidget:

    Haven't used QT much

    If you want a widget, that looks exactly like the one shown above, you could still try to subclass and create your own, custom TabWidget, but I fear, that it might be a little too challenging.

    Here's all you need to know about QStackedWidget (https://doc.qt.io/qt-5/qstackedwidget.html#details)