Show/Hide sub-tab on QTabWidget

删除回忆录丶 提交于 2019-12-05 06:48:17

You only have the option to use:

void QTabWidget::removeTab(int index)

You need to store the pointer to the QWidget in the tab so that you can later insert it.

You could e.g. do something like:

class TabWidget : public QTabWidget
{
   Q_OBJECT

      enum tabwidgets {tabwidget1,tabwidget2,...,number_of_tabwidgets};
      QWidget* widgets_[number_of_tabwidgets];
   public:
      TabWidget(QWidget* parent=0)
      : QWidget(parent)
      {
         for(int i(0);i<number_of_tabwidgets;++i)
     {
        switch(i)
        {
           case tabwidget1:
              insertTab(i,widgets_[i]=new TabWidget1,QString::number(i));
           ....
        }
     }
      }
};
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!