3
votes

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!

1
Are you sure your users want that? It's not so intuitive. I think you can use several QTabWidgets, like Tab1 and Tab2 in the first tabWidget, tab3 and tab4 in the second tabWidget which contains first tabWidget etc, but its behaviour differs from what you want - SpongeBobFan
I am afraid you need to create your own tab bar - instead of QTabBar and use it together with QStackedWidget. - Johny
@SpongeBobFan: I design this form because users require like this. Thanks for your ideas! - Tan Viet
@Johny: Ok, I will try it. Thank you! - Tan Viet

1 Answers

2
votes

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.