Show/Hide sub-tab on QTabWidget
问题 Assuming I have a QTabWidget that contains 5 sub-tabs. Now I want to show/hide a sub-tab in one of 5 sub-tabs by following code ui->twListTabs->widget(0)->hide(); // Hide first sub-tab But this didn’t work for me. Do you have any solutions? Thanks! 回答1: 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