[PyQt] Table changed/modified method

Baz Walter bazwal at ftml.net
Mon Oct 26 19:37:15 GMT 2009


Filippo Rebora wrote:
> self.tableWidget.cellChanged(int, int).connect(self.tableWasModified)
> 
> Still doesn't work

self.tableWidget.cellChanged is a pyqtBoundSignal object.

signals can have several different signatures. so pyqtBoundSignal 
objects define __getitem__ to allow the different signatures to be 
accessed by key like a dict.

in this case, the key is the tuple: (int, int). so your code should be:

self.tableWidget.cellChanged[(int, int)].connect(self.tableWasModified)

or, more cleanly:

self.tableWidget.cellChanged[int, int].connect(self.tableWasModified)

also note that if the signature is omitted, a default signature will be 
used instead. so in this case you could get the same result by using:

self.tableWidget.cellChanged.connect(self.tableWasModified)

(which i believe was suggested earlier in this thread).

HTH


More information about the PyQt mailing list