On Qt, how can I set up a three-column layout with 33% of each?

I have a 3-column layout, and I'm struggling to find a solution to set 3 fluid columns to 33%.

+4
source share
1 answer

I think you are looking for this:

void QBoxLayout :: addWidget (QWidget * widget, int stretch = 0, Qt :: alignment alignment = 0)

Adds a widget to the end of this box layout with a stretch factor and alignment alignment.

The stretch factor applies only in the direction of QBoxLayout and applies to other fields and widgets in this QBoxLayout. Widgets and boxes with higher stretch ratios grow larger.

0, QBoxLayout , QWidget: sizePolicy() , .

. 0, , .

. - :

myLayout->addWidget(myWidget1, 1);
myLayout->addWidget(myWidget2, 1);
myLayout->addWidget(myWidget3, 1);
+3

Source: https://habr.com/ru/post/1541124/


All Articles