Problem in deleting QTabWidget's Widget...
-
wrote on 12 Oct 2011, 14:34 last edited by
HI All,
I have added a QDialog into the QTabWidget...and while i try to remove first QWidget's TabBar...
All TabBar is getting removed from my QTabWidget@
void CTestDlg::addWidget()
{
CQuestionDlg *questionDlg = new CQuestionDlg();
ui->tabExams->addTab( questionDlg , "Question1");
}void CTestDlg::tabClose(int nCurIndex)
{
QWidget *wdgt = ui->tabWidget->widget( nCurIndex );
if( wdgt )
{
delete wdgt;
wdgt = 0;
}
ui->tabWidget->removeTab( nCurIndex );}
@please let me know whether i am doing anything wrong on this..
-
wrote on 12 Oct 2011, 15:00 last edited by
You should call removeTab first
@
QWidget *wdgt = ui->tabWidget->widget( nCurIndex );
ui->tabWidget->removeTab( nCurIndex );
if( wdgt )
delete wdgt;
@wdgt = 0; Not needed because wdgt is local.
-
wrote on 12 Oct 2011, 15:07 last edited by
Thanks Vass ..its working fine....
Thanks for your Valuable inputs..
1/3