I am writing a program to read a number of units consisting of two fields. It has to be graphic, so to store and display all the input fields I use QVBoxLayout and it looks like this: Input fields
In order to avoid all the inconveniences that may occur when the window is resized, I wrote some code to automatically resize this layout so it fills whole window vertically:
void resizeLayout(const int& w, const int& h, QVBoxLayout* box) {
QRect prevGeom = box->geometry();
prevGeom.setHeight(h);
prevGeom.setWidth(w);
box->setGeometry(prevGeom);
}
And it works relatively fine if not for one thing. When I resize it compresses or hides some input fields like this:That's not right Anybody knows what am I doing wrong here?