pyside / PySide

ATTENTION: This project is deprecated, please refer to PySide2
https://wiki.qt.io/PySide2
GNU Lesser General Public License v2.1
291 stars 66 forks source link

QAbstractItemModel.data(index, TextAlignmentRole) alignment flag combo ignored #140

Open Oni opened 8 years ago

Oni commented 8 years ago

If you do something like this redefining QAbstractItemModel.data():

    def data(self, index, role):
        if role == TextAlignmentRole:
            return AlignBottom # it works
            return AlignRight # it also works
            return AlignBottom|AlignRight # it doesn't work
            # you must do this:
            return int(AlignBottom|AlignRight) # it now works

I think it's due to the fact that:

  print AlignBottom|AlignRight
  #: <Alignment object at 0x7f7c70093210>

Since AlignBottom|AlignRight generates an Alignment object, it's not well digested as a return type for QAbstractItemModel.data(index, TextAlignmentRole).

Until this issue is fixed, a simple cast to int will bypass this bug.