Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create multiple rows tab with QTabWidget in Qt?

Tags:

c++

qt

I tried to create a multiple rows tab with QTabWidget like this

Multiple rows

I also set tabPosition = South but I can’t have multiple rows tab because all tabs are horizontal (all of them are in a row, not multi rows). These are the tabs which I got

Multiple rows error

I have read this post but it doesn't help me solve the problem. Does everyone have any ideas or solutions?

Thanks!

like image 839
Tan Viet Avatar asked Sep 18 '25 14:09

Tan Viet


1 Answers

There is no such option by default. You need to implement this behavior manually. Create a vertical layout and put a QStackedWidget and several QTabBars into this layout. Tab contents will be displayed in the stacked widget. You need to add new tab bars when needed and remove them when they are no longer needed. Also you need to check if only one tab is active over all tab bars and display according content in the stacked widget.

like image 69
Pavel Strakhov Avatar answered Sep 20 '25 06:09

Pavel Strakhov