PDA

View Full Version : QTableWidget and signals cellClicked, cellDoubleClicked, cell....



teele
31st July 2010, 20:16
I tried to get a signal from the example spreadsheet table that comes along with the qt 4.6 packages but nothing happens.

I added to the Spreadsheet class the function

void SpreadSheet::detectDoubleClick(int row, int column)
{ formulaInput->setText("a cell doubleclicked");

and connected it

connect(table, SIGNAL( cellDoubleClicked( int row, int column )),
this, SLOT(detectRowSelection(int row, int column)) );
}

The formulaInput QLineEdit field remains intact no matter how fiercely you click on the table of the spreadsheet class.

How could i pick up the clicks on the cells? Or more generally, how to detect clicks on QTableWidget cells?

teele

norobro
31st July 2010, 21:27
Don't click fiercely enough to break your mouse. :D

Didnt you get some warnings on the console? Something like "Object::connect: No such slot ..."

First,the slot name in your connect statement doesn't match the definition name. Second, read this (http://doc.trolltech.com/4.6/qobject.html#connect). Note the sentence beginning with "Note that" in the second paragraph.

teele
1st August 2010, 09:55
Thank you, the parnames in the connect field are not allowed, your advise solved the problem

teele