Solved How to catch a QPushButton signal from a QTableWidget?
Hi, This is my problem: Within a QTableWidget I had a column of QPushButton objects. Every button has the signal clicked connected to the table, the point is: How could I get the corresponding row of the table when a button is clicked?
I tried many signals from the class QTableWidget: currentCellChanged/currentItemChanged/cellClicked but nothing works because the table ignores any event from the buttons, so I guess the signal must come from the QPushButton object... but, how to connect them to get that specific data?
Thanks for any hint.
I found an interesting solution right here (check the last post):
vishwajeet last edited by
Have a look at this class QSignalMapper
You need to have same mechanism which is mentioned in its reference document in Qt Assistant
Darryl DSouza last edited by
Qre you setting the buttons using void QTableWidget::setCellWidget ( int row, int column, QWidget * widget ) ?
Yes, I used the method void QTableWidget::setCellWidget ( int row, int column, QWidget * widget ).
PD: I already resolved the problem extending the class QPushButton, but it's nice to know another possible solutions.
vishnu last edited by
yes. I have used QTableWidget::setCellWidget ( int row, int column, QWidget * widget ) .
IS there any signal I can get from the QTablewidget?