Can't remove a tab from QTabWidget[SOLVED]
-
this code is inside a function "the fuction is a solt of a menu button"
@int i=2;
ui->tabWidget_3->removeTab(i);
i++;
//some code
while(..){
//...
}@the thing is when i insert a break point at line 3
and debug, when i pass line 2 which is removetab ,
and get to line3 ,and even to the wile loop ,
the tab 2 is not removed untill i get out of the functionso is there a way to make it remove that tab
at that line before exitting the fucntion
or there is something that i'm missing about
all this -
how many tabs does your tabbar have?
Please note that the tab index is 0-based. So if you remove the tab with index 2 the third tab is removed. -
are you sure that at the time you call removeTab() the tab bar already has tabs? removeTab() removes the tab immediately.
You may want to check the tab count before calling removeTab() with QTabWidget::count() and output it. -
whats the output of the following:
@
qDebug() << "count before:" << ui->tabWidget_3->count();
int i=2;
ui->tabWidget_3->removeTab(i);
i++;
qDebug() << "count after:" << ui->tabWidget_3->count();
@I think you expect to see the tab to removed while your hold on the breakpoint in the debugger, am i right? This won't happen since you also hold on the event loop which paints the gui.