Sequential row sizes in QGridLayout

I have a dialog like this:

enter image description here

The properties of each component are set to default values, except for titles. I want the line containing label_3to be the same height as the other three lines (and this bottom line needs to be expanded to display the remaining space as shown so that it is clear). The problem is that the checkbox is not the same height as the text fields, so the line has different heights. According to the designer, in the image above label_1and friends have a height of 20, and label_3a height of 13. None of the following attempts worked completely correctly:

  • A package with a layoutRowStretchproperty QGridLayouthas no effect.
  • , , .
  • , :

    ui->label_3->setFixedHeight(ui->label_2->height());
    

    :

    enter image description here

    , label_2->height() 30, 20, , label_3 . , , , .

. , ?

Qt5 .

+4
1

.

, , Qt5.5, minimumSizeHint QLineEdit ( , QtDesigner), QCheckBox .

ui->checkBox->setMinimumHeight(ui->lineEdit->minimumSizeHint().height());

, Hight QLineEdit, minimumSizeHint , . :

ui->checkBox->setMinimumHeight(qMax(ui->lineEdit->minimumSizeHint().height(),
                                    ui->lineEdit->minimumSize().height()));

: OS-, , , minimumSizeHint().height() .

+1

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


All Articles