The documentation for the built-in roles say that certain dataypes are expected to be returned from the model:
Qt::TextAlignmentRole The alignment of the text for items rendered with the default delegate. (Qt::Alignment)
However, actually returning some of those datatypes does not work. For instance for Qt::TextAlignmentRole one actually has to return an int. The reason boils down to the default delegate using an int:
This is very related to having an automatic QFlags to int conversion performed by QVariant (see QTBUG-74639 and friends). If anything, the documentation has to be amended, and I'd really like to have the feature in QVariant itself so one can return the real datatype and not int.