[PyQt] Problem using promoted widgets with PyQt 4.4.2
jan.ekholm at smultron.net
Thu Jul 31 19:13:04 BST 2008
On Thursday 31 July 2008 10:15:34 Jan Ekholm wrote:
> 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.
Renaming the class and Python file to something totally different makes it
work properly. But if I change them to, say, KeywordsTree2
(keywords_tree2.py) or Keywords (keywords.py) the same error persists. So
something goes wrong in PyQt4.uic.loadUi() which makes it associate promoted
widgets that are named something like Keyword.* with PyKDE4.kdeui. Seems
weird, but I can't track down what goes wrong.
So, it all works again now, but if someone else stumbles into this problem,
just rename your class and hope for the best. :)
There were no public health laws in Ankh-Morpork. It would be like
installing smoke detectors in Hell.
-- Terry Pratchett, Feet of Clay
More information about the PyQt