I am unable to combine two alignment flags as per Qt.Alignment documentation which reads: "You can use at most one horizontal and one vertical flag at a time. counts as both horizontal and vertical." <https://doc.qt.io/qtforpython-5/PySide2/QtCore/Qt.html%5C>
This this code snippet should work for a QLabel being added to QGridLayout to align the text vertically in the center of the label, and on the right edge.
field_label = QLabel(fld_player[e] + ': ')
field_label.setAlignment(QtCore.Qt.AlignVCenter)
field_label.setAlignment(QtCore.Qt.AlignRight)
self.data_layout.addWidget(field_label, grid_row, grid_col)
However, the last 'setAlignment' statement becomes the dominant one. At issue is how to make both active.
Thinking order of statement significant, changing the order of execution results in the last 'setAlignment' statement becoming the dominant one.
Reasoning the two alignment flags were single bits in a word (right = 2, vcenter = 128, added = 130 of \b10000010) I have tried adding ('+') the two flags producing a type(int) and a TypeError; 'and'ing is tried with the first in the pair being dominant (not the commutative law).
I am out of ideas.