_ui.tabWidget->addTab(temp, QString::number(p_Cid));
This code implies that the tabWidget is *not* a child of the stack widget, so your UI is probably not defined correctly. If the tab widget was owned by the stack widget, then you would have at least one more level of indirection:
_ui.
stackWidget->tabWidget
->addTab
(temp,
QString::number(p_Cid
));
_ui.stackWidget->tabWidget->addTab(temp, QString::number(p_Cid));
To copy to clipboard, switch view to plain text mode
or, if the same thing was assembled via code:
tabWidget
->addTab
( temp,
QString::number( p_Cid
) );
tabWidget
->addTab
( temp2,
QString::number( p_Cid2
);
//etc.stack->addWidget( tabWidget );
QStackedWidget * stack = new QStackedWidget( mainWidget );
QTabWidget * tabWidget = new QTabWidget( stack );
tabWidget->addTab( temp, QString::number( p_Cid ) );
tabWidget->addTab( temp2, QString::number( p_Cid2 ); //etc.
stack->addWidget( tabWidget );
To copy to clipboard, switch view to plain text mode
And another question - what is "temp"? Is it a unique, new widget pointer that will end up being owned by the tab widget, or are you mistakenly trying to put the same widget instance into multiple tabs? If that's what you're doing, the tab widget probably sees the mistake and deletes the previous tab, since you can't add the same widget instance more than once.
Bookmarks