QVBoxLayout* layout = new QVBoxLayout(); layout->setSizeConstraint(QLayout::SetFixedSize);
QVBoxLayout* layout = new QVBoxLayout(); layout->setSizeConstraint(QLayout::SetMaximumSize);
QVBoxLayout* layout = new QVBoxLayout(); layout->setSizeConstraint(QLayout::SetMinAndMaxSize);This code creates a new QVBoxLayout and sets its size constraint to be the minimum and maximum size. This means that the layout will expand and shrink to fill the available space, but it will not become larger or smaller than its minimum or maximum size. Package library: Qt.