[PyQt] Error in calling QSignalMapper.__bases__

Phil Thompson phil at riverbankcomputing.com
Tue Nov 9 09:49:22 GMT 2010


On Tue, 09 Nov 2010 11:41:05 +0100, Giuseppe Corbelli
<giuseppe.corbelli at copanitalia.com> wrote:
> On 08/11/2010 20:23, Phil Thompson wrote:
>> <giuseppe.corbelli at copanitalia.com> wrote:
>>> Debian Linux 2.6
>>> Python 2.6.6 (r266:84292, Oct  9 2010, 11:40:09) [GCC 4.4.5]
>>> Qt 4.7.0~rc1-1 (Debian package, experimental repo)
>>> PyQt 4.8.1 (last release, compiled from source)
>>>
>>> When I try to execute this:
>>>
>>> from PyQt4 import QtCore
>>>
>>> QtCore.QObject.__bases__
>>> (<type 'sip.wrapper'>,)
>>>
>>> QtCore.QSignalMapper.__bases__
>>>
>>> TypeError
>>> Traceback (most recent call last)
>>> /home/cowo/<ipython console> in <module>()
>>> TypeError: C++ type 'QWidget*' is not supported as a native Qt signal
>> type
>>>
>>> This error did NOT occur with Qt 4.6 and PyQt 4.7.7.
>> 
>> The problem is unique to QSignalMapper. The workaround is to import
>> QtGui..
> 
> The workaround works :-)
> Any idea where the problem may lie?

QSignalMapper is unusual in that it references QWidget from QtCore. If
QtGui hasn't been imported then this reference cannot be satisfied and an
exception is raised.

In previous versions I had correctly ignored this exception - but I hadn't
documented in the code the reason for doing so. With the latest version
this looked like a bug so I "fixed" it...

Phil


More information about the PyQt mailing list