qtabbar

How do I disable one tab in a QTabWidget?

家住魔仙堡 提交于 2019-11-30 03:25:00
问题 I have a QTabWidget called tabWidget. It has three tabs: "Basic", "Advanced", and "Current Structure". The tabs are displayed in the widget in that order. I want to disable the "Advanced" tab whenever the Boolean result is false. I thought it would be as simple as this code: bool result = false; if (result == false) { tabWidget->widget(1)->setDisabled(true); } Unfortunately, this code does not disable the tab, it remains enabled even when I check it: tabWidget->tabBar()->isTabEnabled(1); //

How to implement vertical tabs in QT?

纵饮孤独 提交于 2019-11-29 04:56:54
I am trying to implement vertical tabs with horizontal text with QT but I cannot find any similar option in QTabWidget . Somebody in SO asked for something similar here , however, the answers contain broken links and I doubt that they present a real solution. Anybody has been able to do that? You have to implement a custom QTabBar overwriting the tabSizeHint() and paintEvent() methods as shown below: #include <QApplication> #include <QStyleOptionTab> #include <QStylePainter> #include <QTabBar> #include <QTabWidget> class TabBar: public QTabBar{ public: QSize tabSizeHint(int index) const{ QSize