Problem in SubClassing QTableItem.
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?
Re: Problem in SubClassing QTableItem.
jpn describes the approach you should take in this thread.
Re: Problem in SubClassing QTableItem.
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?
Re: Problem in SubClassing QTableItem.
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.