PDA

View Full Version : How to pop up a MessageBox when QTableWidget row clicked



arunvv
21st April 2008, 21:43
How to pop up a MessageBox when QTableWidget row clicked?
If a table has 2 rows, 5 columns.
If I click on row 1, any column it has to pop up a Message box1 for that row regard less of column number clicked.
If I click on row 2, any column it has to pop up a Message box2 for that row regard less of column number clicked.

For row 1 I used
QObject::connect(tableWidget_wmhData, SIGNAL(cellClicked(1,1)), this, SLOT(wmhID1())); //Where inside wmhID1 has QMessageBox funtionality to pop-up a Message.
Similarly for row 2 , column 1
QObject::connect(tableWidget_wmhData, SIGNAL(cellClicked(2,1)), this, SLOT(wmhVehID1()));

Both these connect statements are implemented in Constructor.
So With this type of implementation I am not able to pop-up a message?
When I run application it say it give an error message:
Error : Object::connect: No such signal QTableWidget::cellClicked(1,1)
Object::connect: (sender name: 'tableWidget_wmhData')
Object::connect: (receiver name: 'MainWindow')

How to implement to get a pop-up Message Box1 as soon as click any cell for row1 ?
Similarly for row2

Thanks & Regards,
Arun

wysota
21st April 2008, 22:43
First of all read this:

http://www.qtcentre.org/forum/faq.php?faq=qt_signalslot#faq_qt_signalslot_with_v alues

Second of all provide a custom slot where you will check which item was clicked and act accordingly.