Reputation: 21
I have a QThread which updates a QTableWidget column values. When the user doubleclicks on a row of that column the QThread stops updating values to let the user edit last read value.
If the users presses Enter then cellChanged(int, int)
signal is emitted and I am able to continue updating values. But in case Esc I get no change signal and I don't know when to restart updating new values.
If I reimplement QTableView eventfilter method to listen to Esc key I can restart the update of values but only if I hit Esc key 2 times. The first time I get out of the QTableWidgetItem. Is it possible to listen to it in first place?
Thanks in advance.
Upvotes: 1
Views: 303
Reputation: 120798
What you really want is a notification that cell editing has finished, regardless of how that may have happened.
One way to achieve that is to reimplement one of the virtual methods responsible for the editing of cells, and then use that to emit a custom signal:
class TableWidget(QtGui.QTableWidget):
editingFinished = QtCore.pyqtSignal()
def closeEditor(self, widget, hint):
QtGui.QTableWidget.closeEditor(self, widget, hint)
self.editingFinished.emit()
Upvotes: 1