So i Have a QVBoxLayout with two child layouts. The first one has labels inside it, and the second one consists of glwidget. The goal is to make first layout the exact size needed to show the labels, not larger, not smaller (widgets are aligned to the top). (So it actually takes a small part of the screen). And i need it to be independent of the window size. I tried some stuff and currently i'm just using addStrech to make it at least passable. So i Was wondering. Could i achieve what i want by the means of layouts management?
QVBoxLayout *v_layout = new QVBoxLayout (this);
QHBoxLayout *labels_layout = new QHBoxLayout (this);
QVBoxLayout *labels_layout1 = new QVBoxLayout (this);
QVBoxLayout *labels_layout2 = new QVBoxLayout (this);
QVBoxLayout *drawer_layout = new QVBoxLayout (this);
number_of_points_label = new QLabel (this);
set_n_label ();
function_name_label = new QLabel (this);
set_func_label ();
state_label = new QLabel (this);
set_state_label ();
fabs_max_label = new QLabel (this);
change_fabs_max_label ();
drawer_layout->addWidget (drawer);
labels_layout->setAlignment (Qt::AlignTop);
labels_layout1->addWidget (number_of_points_label);
labels_layout1->addWidget (function_name_label);
labels_layout1->addWidget (fabs_max_label);
labels_layout2->addWidget (state_label);
labels_layout->addLayout (labels_layout1);
labels_layout->addLayout (labels_layout2);
v_layout->addLayout (labels_layout);
v_layout->addLayout (drawer_layout);
v_layout->setStretchFactor (labels_layout, 1);
v_layout->setStretchFactor (drawer_layout, 8);