PDA

View Full Version : QTabWidget SIGNAL currentChanged()



campana
28th February 2006, 09:50
Hi to all
I'm using a QTabWidget and I want to disable some QAction from MainWindow in the toolbar using the SIGNAL currentChanged()
I'm using this piece of code


MainWindow::MainWindow()
{
int index[3];

myTabWidget = new QTabWidget(this);

myTable1 = new MyTable(1,6,myTabWidget);
myTable1->setFocusPolicy(Qt::StrongFocus);
myTable2 = new MyTablesim(1,9,myTabWidget);
myTable2->setFocusPolicy(Qt::StrongFocus);

setCentralWidget(myTabWidget);

index[0] = myTabWidget->insertTab(0,myTable1,"HSUPA User Param");
index[1] = myTabWidget->insertTab(1,myTable2,"HSUPA Simulation Param");

setWindowTitle("HSUPA GEN");
createActions();
createMenus();
createToolBars();
createStatusBar();
int indice=myTabWidget->currentIndex();
connect(test_button,SIGNAL(clicked()),this,SLOT(gr ey_buttons()));
QObject::connect(myTabWidget,SIGNAL(currentChanged (1)),this,SLOT(grey_buttons()));

}
void MainWindow::grey_buttons(){
addUserAct->setEnabled(false)
}





but I cannot see the icon disabled

What's wrong

Thanks
Manuel

zlatko
28th February 2006, 09:55
Slot must have the same arguments as signal

jpn
28th February 2006, 09:57
QObject::connect(myTabWidget,SIGNAL(currentChanged (1)),this,SLOT(grey_buttons()));



Parameter values or names are not allowed in SIGNAL and SLOT macros.
So try this instead:


connect(myTabWidget,SIGNAL(currentChanged(int)),th is,SLOT(grey_buttons()))

campana
28th February 2006, 10:09
Thanks a lot JPN:) :)