[PyQt] Problem using signal beforeInsert
phil at riverbankcomputing.com
Thu Jan 21 13:43:15 GMT 2010
On Thu, 21 Jan 2010 13:38:45 +0000, bar tomas <bartomas at gmail.com> wrote:
> I've created a QDataWidgetMapper that uses a QSqlRelationalTableModel
> to edit the records of database table.
> I've tried using the signal beforeInsert to do some validation before
> the data is submitted to the database but I have a problem
> intercepting the signal (the slot method test just never executes).
> Here is a snippet of the relevant code:
> self.model = QSqlRelationalTableModel(self)
> self.connect(self.model, SIGNAL("beforeInsert(record)"), self.test)
> def test(self, record):
> print "test"
> Is there something wrong in the way I've declared the connection?
Yes - use the type of the signal argument (ie. QSqlRecord) not its name. Or
use the new-style connection API which will do it for you.
More information about the PyQt