SetAlignment for QStackedLayout
-
Hello,
I use a QStackedWidget, and append a QLabel to it, I want this QLabel to be centered vertically as well as horizontally. I tried using my_stack.layout().setAlignment(QtCore.Qt.AlignCenter) as well as my_stack.layout().setAlignment(my_label, QtCore.Qt.AlignCenter) but none would work.
Why does the alignment does not take effect as it does with QBoxLayout?
Should I use the QStackedLayout alone instead? Perhaps the layout alignment must be set before the layout itself is set?
Thanks for the help.
B. -
PS: I just tried using the QStackedLayout directly and setting the Alignment before setting the layout did not help.
-
I can't figure out what the matter is with QStackedLayout, but I worked around it by placing a QFrame in that layout, with a QHBoxLayout and a centered widget.