Hi! I am trying to connect the beforeInsert signal of a QSqlTableModel, and having some problems.
I've found this similar thread: http://www.mail-archive.com/pyqt@riverbankcomputing.com/msg20117.html However, I am using pyqt with py3k, so I prefer the new style signal and slots, but I appreciate any working solution... So my attempt based on the thread: class BatteryMain(base_class, form_class): # ... def cycle_started(self, record): print("Inserting {!r}".format(record)) def battery_load(self, filename): self.cycles_model = QSqlTableModel(db=self.battery_db) self.connect(self.cycles_model, SIGNAL("beforeInsert(QSqlRecord &)"), self.cycle_started) RESULT: QObject::connect: Cannot queue arguments of type 'QSqlRecord&' (Make sure 'QSqlRecord&' is registered using qRegisterMetaType().) Another attempt with new style signals and slots: class BatteryMain(base_class, form_class): # ... @pyqtSlot('QSqlRecord &') def cycle_started(self, record): print("Inserting {!r}".format(record)) def battery_load(self, filename): self.cycles_model = QSqlTableModel(db=self.battery_db) self.cycles_model.beforeInsert.connect(self.cycle_started) RESULT: File "D:\prg\biQazo\biQazo.py", line 145, in battery_load self.cycles_model.beforeInsert.connect(self.cycle_started) TypeError: connect() failed between beforeInsert(QSqlRecord) and unislot() Could anybody tell me the correct syntax, please? thanks Gergo +-[ Gergely Kontra <pihent...@gmail.com> ]------------------+ | | | Mobile:(+36 20)356 9656 | | | +- "Olyan lángész vagyok, hogy poroltóval kellene járnom!" -+
_______________________________________________ PyQt mailing list PyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt