Reputation: 25
How can i resize QVBoxLayout to fill Form without space?
with space: http://0000.2.img98.net/out.php/i25106_with-space.png
without space: http://0000.2.img98.net/out.php/i25107_without-space.png
Upvotes: 0
Views: 7647
Reputation: 2742
Go to the project folder and find the xml file which you cannot edit under Qt Creator. You will find the margin xml tag. Increase or decrease the value as you need. The xml file cannot be edited under Qt Creator.
Upvotes: 0
Reputation: 5821
You need to adjust the size policy of the widgets contained in the layout.
For example, if you want a widget to take up all the available vertical space in a layout, set the widget's size policy to Expanding
.
Upvotes: 1
Reputation: 2797
You have to set margins for layout
example:
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QVBoxLayout* l = new QVBoxLayout();
l->setMargin(0); ///m
QWidget w; w.setFixedSize(300,300);
w.setLayout(l);
l->addWidget(new QPushButton("fd"));
w.show();
return app.exec();
}
Upvotes: 4