PDA

View Full Version : Wizard and QTableWidget



rmagro
18th September 2008, 10:37
Hi all,

I'm working on a wizard project. In one of its pages I put a QtableWidget.


tableWidget = new QTableWidget(3, 4, this);
for (int row_j=0; row_j < 3; ++row_j)
{
for (int column_i=0; column_i < 4; column_i++)
{
QTableWidgetItem *item = new QTableWidgetItem;
item->setTextAlignment (Qt::AlignCenter);
tableWidget->setItem(row_j, column_i, item);
}
}


then for the first column I have a check box as follow:


tableWidget->item(0, 0)->setCheckState ( Qt::Checked );
tableWidget->item(1, 0)->setCheckState ( Qt::Checked );
tableWidget->item(2, 0)->setCheckState ( Qt::Checked );


My question is, how can I retrieve both the state of each chech box (in the first column) and the values of the other item of the table using the funtions

void registerField ( ... ) and
QVariant field ( ... ) const

??

The QTAssistent shows this only for QLineEdit ..

Thank you very much for your help and kind reply..

Roberto.

jpn
19th September 2008, 19:00
I'm afraid it is not possible using registerField() because first of all QTableWidget does not provide a signal for check state changes, and even if it did, they would carry the changed item as parameter ie. there wouldn't be individual signals for each item.