How to set the ratio of width and height of the widget?
-
wrote on 6 Sept 2019, 16:32 last edited by
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);
-
wrote on 6 Sept 2019, 18:21 last edited by
int QWidget::heightForWidth(int w)
-
wrote on 6 Sept 2019, 18:38 last edited by
It is not work:
ui->labelLogotip->heightForWidth(ui->labelLogotip->height() * 1.5);
-
wrote on 6 Sept 2019, 19:42 last edited by JonB 9 Jun 2019, 19:45
@mikeeeeee
Since Qt always adopts the convention of naming setter functionsset...
, did you tryvoid QSizePolicy::setHeightForWidth(bool dependent)
? -
wrote on 7 Sept 2019, 09:07 last edited by
It's not work:
QSizePolicy sizePolicy1; sizePolicy1.setHeightForWidth(2); ui->labelLogotip->setSizePolicy(sizePolicy1);
5/5