Reputation: 14296
Is it possible to add some widgets to a QTabBar
? I wanted to have a QComboBox
to the side of the last tab, and have it only appear when the last tab is selected.
Upvotes: 1
Views: 449
Reputation: 98505
It's possible to add child overlay widgets to any widget, so the answer is: sure!
You can hook to the tab widgets's or tab bar's signals to get notified when the last tab is selected. Then use tabRect()
to get the rectangle of the last tab. Position your combo box to the right of it. It'd need to be a child of the tab bar. That's it.
Upvotes: 1
Reputation: 147
It might be easier to use a QStackedWidget to get your desired results. When you are using the QStackedWidget you can have different buttons outside that reveal the different widgets. Then use some custom signal for when the last button is activated to show a combobox that appears next to the last button.
Here is the link to the QStackedWidget
Upvotes: -1