How to actually activate sub tab ?
-
I have a main QTab (ui->tabWidget) containing sub-tabs.
I can switch / activate another tab using known indexui->tabWidget->setCurrentIndex(1);
How can I
select the new tab and also select one of its sub-tabs.Can that be done using sub-tab name instead of index?
The sub-tab index is dynamic - new sub-tabs are added using slot. -
I have a main QTab (ui->tabWidget) containing sub-tabs.
I can switch / activate another tab using known indexui->tabWidget->setCurrentIndex(1);
How can I
select the new tab and also select one of its sub-tabs.Can that be done using sub-tab name instead of index?
The sub-tab index is dynamic - new sub-tabs are added using slot.@AnneRanch
QTabWidget::widget(int index)
returns the widget at index.
If it's a tab, you have to make a cast:QWidget* w=tabWidget->widget(1); // widget at tab index 1 QTabWidget* subTab=qobject_cast<QTabWidget*>(w); if(subTab) { subTab->setCurrentIndex(0); // select first tab }