more enum breakage

Kovid Goyal kovid at kovidgoyal.net
Sun Jun 19 05:02:31 BST 2022


>From the gift that keeps on giving department:

Returning Qt.ItemDataRole.TextAlignmentRole from the data() method of
models does not work in PyQt6, one has to return an integer not an enum
for it to work. So, for example:

   return Qt.AlignmentFlag.AlignHCenter | Qt.AlignmentFlag.AlignVCenter

results in text rendered by Qt at top left corner, but

   return (Qt.AlignmentFlag.AlignHCenter | Qt.AlignmentFlag.AlignVCenter).value

works as expected.
-- 
_____________________________________

Dr. Kovid Goyal 
https://www.kovidgoyal.net
https://calibre-ebook.com
_____________________________________


More information about the PyQt mailing list