Issue with latest PyQt6 snapshot

Detlev Offenbach detlev at
Thu Dec 31 12:02:08 GMT 2020

Hi Phil,

I stumbled over an issue related to the enum changes in PyQt6. Executing 
the following in a Python console raises an exception.

 >>> from PyQt6.QtCore import Qt
 >>> Qt.ItemDataRole
<enum 'ItemDataRole'>
 >>> Qt.ItemDataRole.UserRole
<ItemDataRole.UserRole: 256>
 >>> from PyQt6.QtWidgets import QTreeWidgetItem as ti
 >>> t=ti(["a","b"])
 >>> t.setData(0, Qt.ItemDataRole.UserRole,1)
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
TypeError: setData(self, int, int, Any): argument 2 has unexpected type 

What is wrong with this example?


Detlev Offenbach
detlev at

More information about the PyQt mailing list