PDA

View Full Version : Problem in SubClassing QTableItem.



sumsin
22nd May 2006, 08:54
I have created QRadioButton type QTableItem, by subclassing QTableItem.
In createEditor function of QTableItem, I connected widget’s(QRadioButton's) clicked() signal with table’s custom slot reEmitClicked().
In reEmitClicked(), I emit my own custom and overloaded signal clicked(currentRow(), currentCol()).

But when I get the value of currentRow() and currentCol(), it does not match with cell’s row and column, where I clicked.

What is the problem with it?

Am I using the right approach?

munna
22nd May 2006, 09:33
jpn describes the approach you should take in this (http://www.qtcentre.org/forum/showthread.php?t=2310) thread.

sumsin
22nd May 2006, 10:10
Ya, I have Implemented this approach, but what i want when I create a radio button by subclassing the QTableItem. The functions like currentrow() and currentColumn() does not work properly.

And I think I cant implement custom signal and slot in a subclass of QTableItem because it is inherited from Qt.

Then waht should I do?

munna
22nd May 2006, 10:21
Yes, you are right you cannot create signals and slots for QTableItem. Also, your currentRow and currentColumn will not give you right answers because the radio button is focused and not the cell.

I think you should
- subclass QRadioButton and add properties for row and column.
- access the row and column of the focused radio button to get the row and column.