heightForWidth() doesn't work after child call setLayout()
-
I have overwrite heightForWidth().But when I call the setLayout, the heightForWidth cannot work.
PhoneWidget.cpp
PhoneWidget::PhoneWidget(QWidget *parent) : QWidget(parent)
{
m_phoneHeader = new PhoneHeader(this);
m_phoneFooter = new PhoneFooter(this);
m_touchScreen = new TouchScreen(this);
m_touchScreen->setMinimumSize(1, 1);
QBoxLayout *layout = new QVBoxLayout();
layout->setMargin(0);
layout->setSpacing(0);
layout->addWidget(m_phoneHeader);
layout->addWidget(m_touchScreen);
layout->addWidget(m_phoneFooter);
setLayout(layout);
QSizePolicy p(sizePolicy());
p.setHeightForWidth(true);
setSizePolicy(p);
}TopWidget.cpp:
QBoxLayout *mainLayout = new QHBoxLayout();
mainLayout->setMargin(0);
mainLayout->addWidget(m_leftToolBox);
mainLayout->addWidget(m_phoneWidget);
mainLayout->addWidget(m_rightToolBox);
setLayout(mainLayout); -
Hi
is your heightForWidth() called ?
Maybe related to
http://stackoverflow.com/questions/17708449/qwidgetheightforwidth-is-not-calledWhat platform and Qt version?