Issue with latest PyQt6 snapshot

Detlev Offenbach detlev at die-offenbachs.de
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 
'ItemDataRole'

What is wrong with this example?

Detlev

-- 
Detlev Offenbach
detlev at die-offenbachs.de



More information about the PyQt mailing list