[PyKDE] Problem resolving widget's class

Phil Thompson phil at riverbankcomputing.co.uk
Mon Nov 1 16:08:44 GMT 2004

> Hi,
> We're having some difficult-to-reproduce problems with SIP/PyQt. At times,
> widgets don't have their right class, i.e. a widget we know to be a
> QLabel,
> QHeader etc. is instead just a QWidget, which of course breaks code that
> tries to access for instance QLabel methods.
> From what we can tell though, it only happens to widgets that comes from
> "C++
> land", so to speak. That is, widgets that are created by QWidgetFactory,
> the
> listbox you get when calling QComboBox.listBox(), the header from
> QListView.header() etc. This has made us draw the conclusion that there's
> most likely something wrong in SIP?
> We've tried to come up with some kind of way to reproduce it in an orderly
> fashion, but it just can't be done. The only thing we've found so far is
> that
> it seems to be more prone to occur on Windows XP than on Linux, but it
> still
> occurs on both platforms.
> We're using Python 2.3, SIP 4.1.1, PyQt 3.13 and Qt 3.3.3.
> Any help would be appreciated!

I assume it doesn't happen with every widget created in "C++ land" - as
that would be easy to demonstrate. Is there any pattern to when it does

SIP uses the MOC generated class name to determine what Python type to
give the C++ instance, so missing Q_OBJECT in a C++ class or a bad C++
pointer would cause problems - but those are unlikely to be issues in the
Qt library itself.

Is it a pure PyQt application, or are you using other wrapped libraries?


More information about the PyQt mailing list