Center and top align a QVBoxLayout

Viewed 3246

I want let the two code work simultaneously,but I don't know how to do that.

self.botV.setAlignment(Qt.Aligntop)
self.botV.setAlignment(Qt.AlignCenter)

It just do the last one.

1 Answers

I suppose you want a central horizontal alignment and the vertical alignment in the top, then you must use the operator |, also be careful with the case of the variables, Qt uses camelcase:

self.botV.setAlignment(Qt.AlignHCenter | Qt.AlignTop)
Related