Accessing the QTabBar instance
How can I access the QTabBar QTabWidget ?
The only solution I have found is to subclass QTabWidget
and override protected QTabWidget::getTabBar()
as public. Is there any other way to do this?
+2
source to share
3 answers
As you mentioned, subclassing is the right solution as it is protected. Something like that:
class TabWidget : public QTabWidget {
public:
TabWidget(QWidget *p = 0) : QTabWidget(p){}
public:
QTabBar *tabBar() const { return QTabWidget::tabBar(); }
};
You can tell the designer to "promote" your QTabWiget to the TabWidget, then you have a function available tabBar()
.
+4
source to share
What do you want to do in the tab bar?
May not help, but with stylesheets you can customize QTabWidget :: tab and :: tab-bar sub-controls.
+1
source to share