more enum breakage

Kovid Goyal kovid at kovidgoyal.net
Wed Jun 22 10:19:57 BST 2022


And according to Qt this is a bug in PySide not Qt. They are fixing it
by adding extra code to the data() method of models to manually convert
enums to int before returning them to C++. 
https://bugreports.qt.io/browse/PYSIDE-1974
Which is pretty inadequate since they seem to have forgotten there are other
such methods, like headerData().

Seems to me that you will need to implement a fix in PyQt.
I can of course work around this issue in my own code quite easily, if
painstakingly by manually casting to int, but it would be nice to have
to.


On Sun, Jun 19, 2022 at 09:32:31AM +0530, Kovid Goyal wrote:
> >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
> _____________________________________

-- 
_____________________________________

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


More information about the PyQt mailing list