QTableWidget signal cellChanged(): distinguish between user input and change by routines

Posted by crabman on Stack Overflow See other posts from Stack Overflow or by crabman
Published on 2010-03-12T10:02:39Z Indexed on 2010/03/13 12:35 UTC
Read the original article Hit count: 683

Filed under:
|
|
|
|

i am using PyQt but my question is a general Qt one:

I have a QTableWidget that is set up by the function updateTable. It writes the data from DATASET to the table when it is called. Unfortunately this causes my QTableWidget to emit the signal cellChanged() for every cell.

The signal cellChanged() is connected to a function on_tableWidget_cellChanged that reads the contents of the changed cell and writes it back to DATASET. This is necessary to allow the user to change the data manually.

So everytime the table is updated, its contents are written back to DATASET.

Is there a way to distinguish if the cell was changed by the user or by updateTable?

i thought of disconnecting on_tableWidget_cellChanged by updateTable temporarily but that seems to be a little dirty.

© Stack Overflow or respective owner

Related posts about python

Related posts about pyqt