Reputation: 7313
I have tried to re-implement the QTableWidget.cellActivated(row, number) using PyQt4, to catch the coordinates of the currently active cell. The sample below does not work as expected, the method is not activated when a cell is clicked. Have I done something wrong?
class DictionaryTable(QtGui.QTableWidget):
def __init__(self, parent=None):
QtGui.QTableWidget.__init__(self, parent)
def cellActivated(self, row, column):
print row, column
Upvotes: 1
Views: 4222
Reputation: 59574
Looking at the docs, i see:
void QTableWidget::cellActivated ( int row, int column ) [signal]
This signal is emitted when the cell specified by row and column has been activated This function was introduced in Qt 4.1.
This is a signal, not an event. So you don't need to [re]implement cellActivated
method (it's not a method, it's a class attribute of signal type). You need to connect to the signal:
class DictionaryTable(QtGui.QTableWidget):
def __init__(self, language_code, parent=None):
QtGui.QTableWidget.__init__(self, parent)
self.cellActivated.connect(self.handleCellActivated)
def handleCellActivated(self, row, column):
print row, column
Upvotes: 4