Layout centering on QStackedWidget
-
I'm writing a program that uses a QTabWidget as its base. To avoid putting everything in the same place, I'm using a QStackedWidget in one of the tabs so I can put several stuff there, which is a good idea for me.
The problem is, I designed (on Qt Designer) a simple login form, but the problem is I can't seem to be able to center my design on the QStackedWdiget, the layout is always aligned to top-left. I have managed to use a QGridLayout to fake a CSS-like padding design, but I would really like to keep the layout I designed fixed-sized, and it is impossible with QGridLayout, as we all know.
The question is: how can I have my layout centered in the widget, such that the widget would only fill the surrounds much like we can do in QML with the anchors?Thanks in advance.
-
you can use spacers to move your form into the center
else you can use the alignment parameter in "QBoxLayout::addWidget(QWidget * widget, int stretch = 0, Qt::Alignment alignment = 0)":http://doc.qt.nokia.com/4.7/qboxlayout.html#addWidget to align the elements in the center, but you have to layout the form using code and not designer