PDA

View Full Version : Signal from a ComboBox cell in a QTableWidget



thebra
21st October 2008, 00:01
Hi,
I have created a table with QTableWidget which contains few combobox cells.
My question is how can I send signals from a combobox when I change the current index of the combobox?
Thanks for any help!

spirit
21st October 2008, 09:15
how did you add comboboxes, using custom delegate?

thebra
21st October 2008, 09:39
I used this to update a table called ViewData_tableWidget

QStringList TableArgs;

for (int col= 0 ; col < 5 ; col ++ )
{
QComboBox *Box = new QComboBox(this);
Box -> addItems(TableArgs);
ViewData_tableWidget -> setCellWidget(0,col,Box);
}

To send signal I tried this:

connect(ViewData_tableWidget,SIGNAL(cellChanged(in t,int) ),
this, SLOT(ViewData_updateTable(int,int)));

But changing the combo index does not trigger any signal!

Thanks

spirit
21st October 2008, 09:41
what version of Qt do you use?

thebra
21st October 2008, 09:46
I am using QT 4

thanks

spirit
21st October 2008, 09:48
then use delegate for creating comboboxes.
see an example QTDIR/examples/widgets/icons/imagedelegate.cpp.