QStackedLayout and setContentsMargins()
setContentsMargins() seems to not have any effect on QStackedLayout.
This code results in no margin:
Code:
mainLayout->setContentsMargins(20, 20, 20, 20);
mainLayout->addWidget(image);
mainLayout->addWidget(text);
mainLayout->setCurrentIndex(0);
while this has the correct 20 pixels margin
Code:
mainLayout->setContentsMargins(20, 20, 20, 20);
mainLayout->addWidget(image);
Any idea how I can have the margin on QStackedLayout?
Thanks
Re: QStackedLayout and setContentsMargins()
Put it inside a QVBoxLayout with a contentsMargin. Or use QStackedWidget.