[PyQt] QPixmap bug in pyuic 4.4

Jakub Suder jakub.suder at gmail.com
Tue May 20 23:09:49 BST 2008


Hello,

I think I've found a bug in pyuic4... I've been using PyQt 4.3 from
Kubuntu packages, but when I upgraded Qt and Designer to version 4.4,
pyuic started to choke on the output from the designer, it seems they
changed something in the format. So I compiled PyQt 4.4 from source,
and now pyuic manages to generate the output file, but an exception is
thrown when the file is run. It seems that there's a parentheses in a
wrong place in such line:

 File "./test.py", line 16, in setupUi
   icon.addPixmap(QtGui.QPixmap(":/icons/menu/add_user.png",QtGui.QIcon.Normal,QtGui.QIcon.Off))
TypeError: argument 2 of QPixmap() has an invalid type

The last 2 parameters should be arguments of addPixmap, not of QPixmap
constructor. I fixed this by updating a line in the source code of
pyuic, in properties.py, function _iconset, line 145:

icon.addPixmap(QtGui.QPixmap(e.text.replace("\\", "\\\\"), mode, state))
to
icon.addPixmap(QtGui.QPixmap(e.text.replace("\\", "\\\\")), mode, state)

Now the generated file can be run and everything seems to be ok.

Best regards,
Jakub


More information about the PyQt mailing list