I have a label:
self.label = QtLabel(self)
that is inside of a VBoxLayout.
That I want to set in the center of a QWizardPage, no matter what size the window becomes. I managed to get it centered horizontally with:
self.label.setAlignment(QtCore.Qt.AlignCenter)
but I cannot seem to get it to center vertically too. I've tried
self.label.setAlignment(QtCore.Qt.AlignVCenter)
and:
self.label.setAlignment(QtCore.Qt.AlignCenter | AlignVCenter)
and a couple of other things that I cannot remember at this moment (I'll edit if I do). After reading this answer it seemed the problem had something to do with setting a min and max size. I tried that, setting MinimumHeight and MaximumHeight to 200
. That roughly centered the label but it doesn't adapt to changes in the window's height, only its width.
How can I center this label directly in the middle of my page?