[PyQt] pyqt 4.6 error

Linos info at linos.es
Tue Oct 6 22:42:40 BST 2009


Hello,
	i have updated versions to sip 4.9 and pyqt 4.6 and finally i have some time to 
make reproducible examples of the errors i posted to the mailing list some time 
ago, this code gives me on my machine (Arch Linux, qt 4.5.2, sip 4.9, pyqt 4.6 
and python 2.6.3) this error when i push the button:

Traceback (most recent call last):
   File "error_emit.py", line 18, in testEmit
     self.emit(SIGNAL("cambiaFoto(QVariant, QVariant)"), QVariant(), QVariant())
TypeError: argument 0 of signal PyQtProxy.ambiaFoto(QVariant,QVariant) has an 
invalid type


---CODE----

# -*- coding: utf-8 -*-
import sys
from PyQt4.QtCore import *
from PyQt4.QtGui import *

class TestPythonClass(object):
     def __init__(self):
         pass

class TestSubClass(QAbstractTableModel, TestPythonClass):
     def __init__(self, parent):
         super(TestSubClass, self).__init__()
         TestPythonClass.__init__(self)

         self.testEmit()

     def testEmit(self):
         self.emit(SIGNAL("cambiaFoto(QVariant, QVariant)"), QVariant(), QVariant())

class TestWidget(QWidget):
     def __init__(self, parent):
         super(TestWidget, self).__init__()
         self.model = TestSubClass(self)
         self.connect(self.model, SIGNAL("cambiaFoto(QVariant, QVariant)"), 
self.printIsNull)

         self.button = QPushButton("test")
         self.connect(self.button, SIGNAL("clicked()"), self.model.testEmit)

         layout = QVBoxLayout()
         layout.addWidget(self.button)
         self.setLayout(layout)

     def printIsNull(self, one, two):
         print one.isNull()


def main():
     app = QApplication(sys.argv)

     widget = TestWidget(None)
     widget.show()
     return app.exec_()

if __name__ == "__main__":
     main()

---CODE----

Regards,
Miguel Angel.


More information about the PyQt mailing list