PDA

View Full Version : QTabWidget -> closing 1st tab unexpectedly closes all tabs



Ban-chan
14th July 2009, 00:02
I have a QTabWidget setup with close buttons on each tab. It works fine as I dynamically add and remove tabs except for clicking close on whichever is the first tab. Doing so causes all tabs to close. Anyone have an idea why this might be happening?

rexi
14th July 2009, 00:37
Please supply the code that you are using. Without that, we can't but guess what is wrong with your approach...

Ban-chan
14th July 2009, 15:25
I didn't post code originally since I was simply using basic functions but here it is anyways:

graphTabs->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);

graphTabs->setMovable(true);
graphTabs->setTabShape(QTabWidget::Rounded);
graphTabs->setTabPosition(QTabWidget::North);
graphTabs->setTabsClosable(true);
graphTabs->setMinimumWidth(500);
graphTabs->setContentsMargins(0,0,0,0);


connect(graphTabs, SIGNAL(tabCloseRequested(int)),this,SLOT(hideTab(i nt)));



void MainWindow::hideTab(int tab_index)
{
graphTabs->removeTab(tab_index);
}

All tabs are added like this:

graphTabs->addTab(rawPage->graphs,"&Raw Data");