Why doesnt my QGridLayout resize?
This resizes perfectly ------
Code:
layout->setSpacing(6);
layout->setMargin(11);
QPlainTextEdit* mybox = new QPlainTextEdit(this);
layout->addWidget(mybox, 0, 0, 1, 2);
setLayout(layout);
This doesnt resize at all ------
Code:
layout->setSpacing(6);
layout->setMargin(11);
QPlainTextEdit* mybox = new QPlainTextEdit(this);
layout->addWidget(mybox, 0, 0, 1, 2);
setLayout(layout);
The only difference is with the 2nd example, im creating a widget* and making the layout a child of that widget which is what Qt Designer does.. How can I make this resize work using the 2nd example?
Re: Why doesnt my QGridLayout resize?
Try:
Code:
layout->setSpacing(6);
layout->setMargin(11);
QPlainTextEdit* mybox = new QPlainTextEdit(this);
layout->addWidget(mybox, 0, 0, 1, 2);
layout->addWidget(widget, 0, 0, 1, 3); //<--or whatever you need
setLayout(layout);
Re: Why doesnt my QGridLayout resize?
QLayout constructor already calls QWidget::setLayout(). So the following code doesn't make sense:
Code:
...
setLayout(layout);
First you install the layout on "widget", then you attempt to install the same layout on "this".