[PyQt] Problem using promoted widgets with PyQt 4.4.2

Jan Ekholm jan.ekholm at smultron.net
Thu Jul 31 08:15:34 BST 2008

On Thursday 31 July 2008 09:53:24 Jan Ekholm wrote:
> On Wednesday 30 July 2008 14:25:37 Jan Ekholm wrote:
> > On Wednesday 30 July 2008 13:47:55 Jan Ekholm wrote:
> > <snip>
> >
> >
> > I cut the window down to a minimal example that for me does not work. The
> > files are all attached and the code is also inline below. I assume I do
> > something silly, but for the love of Darwin I can't figure it out.
> Ok, I did some checking and the module is actually loaded in:
>     /usr/lib/python2.5/site-packages/PyQt4/uic/Loader/qobjectcreator.py
> Simply printing the module and class it tries to load reveals for my normal
> working classes a pairs like this:
>     image_browser ImageBrowser
>     image_label ImageLabel
>     image_info ImageInfo
>     tags Tags
> But for my ill fated KeywordTree I see:
>     PyKDE4.kdeui KeywordTree
> So somehow something assumes that my class should be in the PyKDE4.kdeui
> module instead of ./keyword_tree.py as it should be. I don't use any PyKDE4
> classes at all, this is a pure PyQt application and always has been.
> Does this somehow ring a bell to someone? I haven't yet tracked down why
> that class should be in PyKDE4.kdeui.

Seems that QObjectCreator.addCustomWidget 
in /usr/lib/python2.5/site-packages/PyQt4/uic/objcreator.py manages to find a 
class named KeywordTree in PyKDE4.kdeui. When that method is entered the data 
is all fine and when done it's wrong, ie when entering:

    widgetClass=KeywordTree baseClass=QTreeWidget module=keyword_tree

and when exiting:

    widgetClass=KeywordTree baseClass=QTreeWidget module=PyKDE4.kdeui

I haven't yet found what actually imports and PyKDE4 classes and why, because 
it sure ain't my code.

I'll try renaming my class to something totally different and see if PyQt then 
loads the class properly.


        Most gods find it hard to walk and think at the same time.
                                             -- Terry Pratchett, Small Gods

More information about the PyQt mailing list