⚠️ Forum Maintenance: Feb 6th, 8am - 14pm (UTC+2)
How to set the ratio of width and height of the widget?
-
Hi!
How to set the ratio of width and height of the widget?
It is not works:ui->labelLogotip->setMinimumWidth(ui->labelLogotip->height() * 1.5);
-
int QWidget::heightForWidth(int w)
-
It is not work:
ui->labelLogotip->heightForWidth(ui->labelLogotip->height() * 1.5);
-
@mikeeeeee
Since Qt always adopts the convention of naming setter functionsset...
, did you tryvoid QSizePolicy::setHeightForWidth(bool dependent)
?
-
It's not work:
QSizePolicy sizePolicy1; sizePolicy1.setHeightForWidth(2); ui->labelLogotip->setSizePolicy(sizePolicy1);