BUG: pyuic6 doesn't use icon state enums

Phil Thompson phil at riverbankcomputing.com
Fri Jan 8 12:05:23 GMT 2021


On 08/01/2021 11:36, David Morris wrote:
> 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*)

Should be fixed the next snapshot.

Thanks,
Phil


More information about the PyQt mailing list