[PyQt] Bug in sip-4.11.1 and PyQt-4.7.7 ?

Gerard Vermeulen gav451 at gmail.com
Mon Sep 27 19:45:37 BST 2010


 Phil,

when running the following code

#!/usr/bin/env python
# -*- coding: utf-8 -*-

import PyQt4.Qt as Qt

class MyWidget(Qt.QWidget):
   
    def __init__(self, parent=None):
        super(Qt.QWidget, self).__init__(parent)

     # __init__()
    
# class MyWidget

def bar(widget):
    pass

# bar()

def foo(widget):
    print type(widget)
    # BUG? For me widget is a Python type, but not for widget.connect().
    widget.connect(widget, Qt.SIGNAL('item_changed(widget)'), bar)

# foo()

if __name__ == '__main__':
    application = Qt.QApplication([])
    widget = MyWidget()
    foo(widget)

# Local Variables: ***
# mode: python ***
# End: ***

I get this traceback:

<class '__main__.MyWidget'>
Traceback (most recent call last):
  File "bug.py", line 31, in <module>
    foo(widget)
  File "bug.py", line 23, in foo
    widget.connect(widget, Qt.SIGNAL('item_changed(widget)'), bar)
TypeError: C++ type 'widget' is not supported as a slot argument type

but isn't widget a Python type? (although derived from a C++ type)

Best regards -- Gerard



More information about the PyQt mailing list