BUG: pyuic6 doesn't use icon state enums

David Morris othalan at othalan.net
Fri Jan 8 11:36:23 GMT 2021


I am converting an application to PyQt6 and came across a bug in pyuic6.

Removing references to pyrcc5, I used QtCreator to set icon filenames
directly in a .ui file (instead of pointing to the resource file).

When I compile the file using pyuic6 and attempt to display the test
window, I receive the following error:

❯ python PlaybackControl_UI.py
> Traceback (most recent call last):
>   File "[...]/PlaybackControl_UI.py", line 112, in <module>
>     ui.setupUi(PlaybackControl)
>   File "[...]/PlaybackControl_UI.py", line 36, in setupUi
>     icon.addPixmap(QtGui.QPixmap("icons/Media-skip-backward.svg"),
> *QtGui.QIcon.Normal*, *QtGui.QIcon.Off*)
> AttributeError: type object 'QIcon' has no attribute 'Normal'


This occurs because enumerated states were moved into enum objects.  The
generated code should read:

icon.addPixmap(QtGui.QPixmap("icons/Media-skip-backward.svg"),
*QtGui.QIcon.Mode.Normal*, *QtGui.QIcon.State.Off*)

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20210108/aeeb4401/attachment.htm>


More information about the PyQt mailing list