[Interest] Telling which QTableWidgetItem was changed?

Robert Wood robert.wood at apostrophe.co.uk
Tue Jul 1 12:26:49 CEST 2014


Folks,

I have a dynamically created table; whenever I add a new row, I do this:

     QCheckBox *cb = new QCheckBox();
     ui->innoLEDListTable->setCellWidget(row,0,cb);


     connect(cb,SIGNAL(clicked()),this,SLOT(tableItemClicked()));


Now this works fine in that whenever I click a check box in the table, 
it calls my function tableItemClicked(). However, having tried a 
plethora of different ways, I cannot work out how to have the called 
function detect which check box it was that was ticked or cleared. There 
must be a way of doing it!

I thought this was going to solve it:

http://www.qtforum.org/article/26960/qtablewidgetitem-signals.html

But I get this error:

/usr/lib64/qt5/include/QtCore/qobjectdefs.h:489: error: 'qt_metacall' is 
not a member of 'QTableWidgetItem'
          enum { Value =  sizeof(test(&Object::qt_metacall)) == 
sizeof(int) };
                                      ^
To make things clear, each new row I insert in the table, when the check 
box is clicked, I successfully call my function, it's just I need to 
work out which of the [potentially] many check boxes was clicked to take 
me to that slot!

Many thanks,

Rob





More information about the Interest mailing list