Tan Viet
Tan Viet

Reputation: 2113

How to create multiple rows tab with QTabWidget in 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!

Upvotes: 4

Views: 4047

Answers (2)

Pamputt
Pamputt

Reputation: 440

There is this request on the Qt bug tracker asking for such feature

Upvotes: 1

Pavel Strakhov
Pavel Strakhov

Reputation: 40492

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.

Upvotes: 3

Related Questions