QTabWidgets: I can't remove a tab
Hello,
Sorry for my English. I'm new to Qt, in my project the user can move from one tab to the next one. ( Slot of the button: ui->Pestanas->insertTab(1, ui->Pestana_Orden_Trabajo, "Orden de Trabajo");
ui->Pestanas->setCurrentIndex(1); )
It works, but I would like to just show the first tab when the window appears for the first time.
I've tried this:
Code:
ui(new Ui::Partes)
{
ui->setupUi(this);
ui->Pestanas->setCurrentIndex(0);
ui->Pestanas->removeTab(1);
ui->Pestanas->removeTab(2);
}
It makes disappear the second tab that comes with the QTabWidget deffault form when you first include it in the ui. But the the tab that I added for designing the widgets I want it to bring inside doesn't disappear.
Does anyone know any way to do it?
Thanks for replying!
Re: QTabWidgets: I can't remove a tab
lets say you have 3 tabs, index 0, 1, 2
Code:
ui->Pestanas->setCurrentIndex(0);
ui->Pestanas->removeTab(1);
ui->Pestanas->removeTab(2);
You set current tab to first tab. //index 0
And you removed 2nd tab with //ui->Pestanas->removeTab(1); //index 1
Now tab indexes will changed, now tab indexes you have are : 0, 1
And now you are trying to remove 3rd Tab(index 2) which is not there //ui->Pestanas->removeTab(2);
Try this:
Code:
ui->Pestanas->removeTab(1);
ui->Pestanas->removeTab(1);
Re: QTabWidgets: I can't remove a tab
Your solution solved my problem!
Very well explained.
Thank you very much!