luis | 2020-09-30 16:19:14 UTC | #1
I'm working with the PySide2 edition of the book and I'm not getting the correct alignments in tableview_format_3.py or tableview_format_4.py
It seems to be a PySide2 bug: https://bugreports.qt.io/browse/PYSIDE-20
I had to change the code from
return Qt.AlignVCenter | Qt.AlignRight
to
return int(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
edit: my current setup is: Win10, Python 3.8.6 and PySide2 5.15.0
martin | 2020-09-30 16:22:47 UTC | #2
Hi @luis welcome to the forum!
Never miss an update
Enjoyed this? Subscribe to get new updates straight in your Inbox.
Thanks for the heads up and the workaround -- the handling of these flags is one of the few things really noticeably different between PyQt5 & PySide2 (the two versions of the books differ quite a bit in this chapter) so I'll get a note about this in the next PySide2 update.
Even once it's fixed, this workaround will still be fine, so don't worry about using it in projects.