Create tabs for QTabWidget, but do not display all tabs.
Solved
General and Desktop
-
I've added tabs to my QTabWidget in the following way ...
tabs = new QTabWidget; tabs->addTab(new Tab1(mywidget), tr("Tab 1")); tabs->addTab(new Tab2, tr("Tab 2"));
Tab1 and Tab2 are classes derived from QWidget. I'd like to just create, say Tab2, but not actually display this tab. But somehow have a handle to the tabs I do not add yet so that I can add and remove them at will.
How would this be done?
-
I'd like to just create, say Tab2, but not actually display this tab.
Simply
QWidget* tab2 = new Tab2()
.But somehow have a handle to the tabs I do not add yet
The pointer is a"handle".
so that I can add and remove them at will.
Just use
addTab
/removeTab
as in your example whenever you need.